ssb: Missed a few connection failures for context.

This commit is contained in:
Cory McWilliams 2024-11-13 18:44:14 -05:00
parent fa94442eb2
commit 20701d9cf1

View File

@ -511,7 +511,9 @@ static void _tf_ssb_write(tf_ssb_connection_t* connection, void* data, size_t si
if (result) if (result)
{ {
tf_ssb_connection_adjust_write_count(connection, -1); tf_ssb_connection_adjust_write_count(connection, -1);
_tf_ssb_connection_close(connection, "write failed"); char buffer[256];
snprintf(buffer, sizeof(buffer), "write failed : %s", uv_strerror(result));
_tf_ssb_connection_close(connection, buffer);
tf_free(write); tf_free(write);
} }
} }
@ -2127,8 +2129,9 @@ static bool _tf_ssb_connection_read_start(tf_ssb_connection_t* connection)
int result = uv_read_start((uv_stream_t*)&connection->tcp, _tf_ssb_connection_on_tcp_alloc, _tf_ssb_connection_on_tcp_recv); int result = uv_read_start((uv_stream_t*)&connection->tcp, _tf_ssb_connection_on_tcp_alloc, _tf_ssb_connection_on_tcp_recv);
if (result && result != UV_EALREADY) if (result && result != UV_EALREADY)
{ {
tf_printf("uv_read_start => %s\n", uv_strerror(result)); char reason[1024];
_tf_ssb_connection_close(connection, "uv_read_start failed"); snprintf(reason, sizeof(reason), "uv_read_start failed: %s", uv_strerror(result));
_tf_ssb_connection_close(connection, reason);
return false; return false;
} }
return true; return true;
@ -2139,8 +2142,9 @@ static bool _tf_ssb_connection_read_stop(tf_ssb_connection_t* connection)
int result = uv_read_stop((uv_stream_t*)&connection->tcp); int result = uv_read_stop((uv_stream_t*)&connection->tcp);
if (result && result != UV_EALREADY) if (result && result != UV_EALREADY)
{ {
tf_printf("uv_read_stop => %s\n", uv_strerror(result)); char reason[1024];
_tf_ssb_connection_close(connection, "uv_read_stop failed"); snprintf(reason, sizeof(reason), "uv_read_stop failed: %s", uv_strerror(result));
_tf_ssb_connection_close(connection, reason);
return false; return false;
} }
return true; return true;
@ -2160,7 +2164,9 @@ static void _tf_ssb_connection_on_connect(uv_connect_t* connect, int status)
} }
else else
{ {
_tf_ssb_connection_close(connection, "uv_tcp_connect failed"); char reason[1024];
snprintf(reason, sizeof(reason), "uv_tcp_connect failed: %s", uv_strerror(status));
_tf_ssb_connection_close(connection, reason);
} }
} }