fix: Correct tenant listen bug

master
Sean McBride 3 years ago
parent 01cca785f4
commit 69a6cbaa46

@ -112,7 +112,14 @@
"sledge_abi.h": "c",
"vec.h": "c",
"module_database.h": "c",
"perf_window_t.h": "c"
"perf_window_t.h": "c",
"typeinfo": "c",
"module_config.h": "c",
"tenant.h": "c",
"route_config.h": "c",
"http_router.h": "c",
"admissions_info.h": "c",
"tcp_server.h": "c"
},
"files.exclude": {
"**/.git": true,
@ -173,5 +180,6 @@
"mctx",
"TKILL",
"WASI"
]
],
"C_Cpp.errorSquiggles": "Enabled"
}

@ -80,6 +80,8 @@ tcp_server_listen(struct tcp_server *server)
rc = listen(socket_descriptor, TCP_SERVER_MAX_PENDING_CLIENT_REQUESTS);
if (unlikely(rc < 0)) goto err_listen;
printf("Listening on port %d\n", server->port);
rc = 0;
done:
return rc;

@ -193,8 +193,6 @@ listener_thread_main(void *dummy)
continue;
}
http_request_print(&session->http_request);
/*
* Perform admissions control.
* If 0, workload was rejected, so close with 429 "Too Many Requests"

@ -451,8 +451,6 @@ main(int argc, char **argv)
if (tenant_config_vec_len < 0) { exit(-1); }
free(json_buf);
// for (int i = 0; i < tenant_config_vec_len; i++) { tenant_config_print(&tenant_config_vec[i]); }
for (int tenant_idx = 0; tenant_idx < tenant_config_vec_len; tenant_idx++) {
struct tenant *tenant = tenant_alloc(&tenant_config_vec[tenant_idx]);
int rc = tenant_database_add(tenant);
@ -464,19 +462,19 @@ main(int argc, char **argv)
/* Start listening for requests */
rc = tenant_listen(tenant);
if (rc < 0) exit(-1);
}
for (int tenant_idx = 0; tenant_idx < tenant_config_vec_len; tenant_idx++) {
tenant_config_deinit(&tenant_config_vec[tenant_idx]);
}
free(tenant_config_vec);
for (int i = 0; i < runtime_worker_threads_count; i++) {
int ret = pthread_join(runtime_worker_threads[i], NULL);
if (ret) {
errno = ret;
perror("pthread_join");
exit(-1);
}
for (int tenant_idx = 0; tenant_idx < tenant_config_vec_len; tenant_idx++) {
tenant_config_deinit(&tenant_config_vec[tenant_idx]);
}
free(tenant_config_vec);
for (int i = 0; i < runtime_worker_threads_count; i++) {
int ret = pthread_join(runtime_worker_threads[i], NULL);
if (ret) {
errno = ret;
perror("pthread_join");
exit(-1);
}
}

Loading…
Cancel
Save