Make toasty client thread-safe and implement toasty_wakeup

This commit is contained in:
2025-11-20 03:51:01 +01:00
parent 9b40edb56c
commit b0313ffcf8
7 changed files with 341 additions and 49 deletions
+6 -1
View File
@@ -1001,7 +1001,8 @@ int metadata_server_init(MetadataServer *state, int argc, char **argv, void **co
for (int i = 0; i < MAX_CHUNK_SERVERS; i++)
state->chunk_servers[i].used = false;
tcp_context_init(&state->tcp);
if (tcp_context_init(&state->tcp) < 0)
return -1;
int ret = tcp_listen(&state->tcp, addr, port);
if (ret < 0) {
@@ -1050,6 +1051,10 @@ int metadata_server_step(MetadataServer *state, void **contexts, struct pollfd *
int conn_idx = events[i].conn_idx;
switch (events[i].type) {
case EVENT_WAKEUP:
// Do nothing
break;
case EVENT_CONNECT:
tcp_set_tag(&state->tcp, conn_idx, CONNECTION_TAG_UNKNOWN, false);
break;