Skip to content

Commit

Permalink
Change port from uint16_t to uint32_t, to support VSOCK (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
graebm authored Dec 30, 2023
1 parent f181339 commit 63d1e10
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/aws/event-stream/event_stream_rpc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct aws_event_stream_rpc_client_connection_options {
/** host name to use for the connection. This depends on your socket type. */
const char *host_name;
/** port to use for your connection, assuming for the appropriate socket type. */
uint16_t port;
uint32_t port;
/** socket options for establishing the connection to the RPC server. */
const struct aws_socket_options *socket_options;
/** optional: tls options for using when establishing your connection. */
Expand Down
4 changes: 2 additions & 2 deletions include/aws/event-stream/event_stream_rpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct aws_event_stream_rpc_server_listener_options {
/** host name to use for the listener. This depends on your socket type. */
const char *host_name;
/** port to use for your listener, assuming for the appropriate socket type. */
uint16_t port;
uint32_t port;
const struct aws_socket_options *socket_options;
/** optional: tls options for using when setting up your server. */
const struct aws_tls_connection_options *tls_options;
Expand Down Expand Up @@ -140,7 +140,7 @@ AWS_EVENT_STREAM_API void aws_event_stream_rpc_server_listener_release(
* Get the local port which the listener's socket is bound to.
*/
AWS_EVENT_STREAM_API
uint16_t aws_event_stream_rpc_server_listener_get_bound_port(
uint32_t aws_event_stream_rpc_server_listener_get_bound_port(
const struct aws_event_stream_rpc_server_listener *listener);

/**
Expand Down
6 changes: 4 additions & 2 deletions source/event_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,8 @@ int aws_event_stream_add_bytebuf_header(
.header_name_len = name_len,
.header_value_len = value_len,
.value_owned = copy,
.header_value_type = AWS_EVENT_STREAM_HEADER_BYTE_BUF};
.header_value_type = AWS_EVENT_STREAM_HEADER_BYTE_BUF,
};

return s_add_variable_len_header(headers, &header, name, name_len, value, value_len, copy);
}
Expand Down Expand Up @@ -1607,7 +1608,8 @@ void aws_event_stream_streaming_decoder_init(
.on_prelude = on_prelude,
.on_header = on_header,
.on_error = on_error,
.user_data = user_data};
.user_data = user_data,
};
aws_event_stream_streaming_decoder_init_from_options(decoder, alloc, &decoder_options);
}

Expand Down
2 changes: 1 addition & 1 deletion source/event_stream_rpc_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ struct aws_event_stream_rpc_server_listener *aws_event_stream_rpc_server_new_lis
return NULL;
}

uint16_t aws_event_stream_rpc_server_listener_get_bound_port(
uint32_t aws_event_stream_rpc_server_listener_get_bound_port(
const struct aws_event_stream_rpc_server_listener *server) {

struct aws_socket_endpoint address;
Expand Down
2 changes: 1 addition & 1 deletion tests/event_stream_rpc_server_connection_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static int s_fixture_setup_port0(struct aws_allocator *allocator, void *ctx) {
test_data->listener = aws_event_stream_rpc_server_new_listener(allocator, &listener_options);
ASSERT_NOT_NULL(test_data->listener);

uint16_t actual_port = aws_event_stream_rpc_server_listener_get_bound_port(test_data->listener);
uint32_t actual_port = aws_event_stream_rpc_server_listener_get_bound_port(test_data->listener);
ASSERT_TRUE(actual_port > 0);

test_data->allocator = allocator;
Expand Down

0 comments on commit 63d1e10

Please sign in to comment.