Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ichishino committed Jan 9, 2024
1 parent 03eabaf commit 3c3a468
Show file tree
Hide file tree
Showing 29 changed files with 1,672 additions and 769 deletions.
2 changes: 1 addition & 1 deletion test/test_http/test_http_server_http_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ http_server_on_http_request(
co_http_send_chunked_data(http_client, &data[index], 1);
}

co_http_end_chunked_response(http_client);
co_http_finish_chunked_response(http_client);
}
else if (strcmp(url->path, "/stop") == 0)
{
Expand Down
20 changes: 10 additions & 10 deletions test/test_http/test_http_server_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ http_server_on_tls_handshake(
{
if (error_code != 0)
{
co_tls_client_destroy(tcp_client);
co_tls_tcp_client_destroy(tcp_client);

return;
}

char protocol[32];


if (co_tls_get_selected_protocol(
if (co_tls_tcp_get_selected_protocol(
tcp_client, protocol, sizeof(protocol)))
{
if (strcmp(protocol, CO_HTTP2_PROTOCOL) == 0)
Expand All @@ -36,7 +36,7 @@ http_server_on_tls_handshake(
else if (strcmp(protocol, CO_HTTP_PROTOCOL) != 0)
{
// unknown
co_tls_client_destroy(tcp_client);
co_tls_tcp_client_destroy(tcp_client);

return;
}
Expand All @@ -58,7 +58,7 @@ http_server_on_tcp_close(
{
(void)self;

co_tls_client_destroy(tcp_client);
co_tls_tcp_client_destroy(tcp_client);
}

static void
Expand All @@ -78,11 +78,11 @@ http_server_on_tcp_accept(
(co_tcp_close_fn)http_server_on_tcp_close;

co_tls_callbacks_st* tls_callbacks =
co_tls_get_callbacks(tcp_client);
co_tls_tcp_get_callbacks(tcp_client);
tls_callbacks->on_handshake =
(co_tls_handshake_fn)http_server_on_tls_handshake;

co_tls_start_handshake(tcp_client);
co_tls_tcp_start_handshake(tcp_client);
}

//---------------------------------------------------------------------------//
Expand Down Expand Up @@ -149,13 +149,13 @@ on_http_server_thread_create(
return false;
}

self->server = co_tls_server_create(&local_net_addr, &tls_ctx);
self->server = co_tls_tcp_server_create(&local_net_addr, &tls_ctx);

size_t protocol_count = 2;
const char* protocols[] = { CO_HTTP2_PROTOCOL, CO_HTTP_PROTOCOL };
// size_t protocol_count = 1;
// const char* protocols[] = { CO_HTTP_PROTOCOL };
co_tls_server_set_available_protocols(
co_tls_tcp_server_set_available_protocols(
self->server, protocols, protocol_count);

co_socket_option_set_reuse_addr(
Expand All @@ -166,15 +166,15 @@ on_http_server_thread_create(
callbacks->on_accept =
(co_tcp_accept_fn)http_server_on_tcp_accept;

return co_tls_server_start(self->server, SOMAXCONN);
return co_tls_tcp_server_start(self->server, SOMAXCONN);
}

static void
on_http_server_thread_destroy(
http_server_thread* self
)
{
co_tls_server_destroy(self->server);
co_tls_tcp_server_destroy(self->server);

co_list_destroy(self->http_clients);
co_list_destroy(self->http2_clients);
Expand Down
2 changes: 1 addition & 1 deletion test/test_http/test_ws_http2_client_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ ws_http2_client_on_thread_create(
callback->on_close =
(co_http2_close_fn)ws_http2_client_on_close;

co_http2_connect(self->http2_client);
co_http2_start_connect(self->http2_client);

return true;
}
Expand Down
3 changes: 3 additions & 0 deletions test/test_suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ add_executable(${PROJECT_NAME}
main.c
test_app.c
test_tcp.c
test_tcp_mt_client.c
test_tcp_mt_server.c
test_tcp_server.c
test_tcp_server_comm.c
test_udp.c
test_udp_server.c
test_udp2.c
Expand Down
11 changes: 9 additions & 2 deletions test/test_suite/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
# endif
#endif

void on_signal(int sig)
void
on_signal(
int sig
)
{
test_info("**** signal: (%d)", sig);

Expand All @@ -22,7 +25,11 @@ void on_signal(int sig)
// main
//---------------------------------------------------------------------------//

int main(int argc, char** argv)
int
main(
int argc,
char** argv
)
{
signal(SIGINT, on_signal);

Expand Down
Loading

0 comments on commit 3c3a468

Please sign in to comment.