Better half time

This commit is contained in:
Ano-sys
2025-02-05 21:55:21 +01:00
parent c370a35d98
commit c31fee2608
26 changed files with 241 additions and 965 deletions
+5 -11
View File
@@ -83,6 +83,10 @@ void* workerFunc(void *args){
return NULL;
}
int timeout = SEND_RECV_TIMEOUT;
zmq_setsockopt(responder, ZMQ_RCVTIMEO, &timeout, sizeof(timeout));
zmq_setsockopt(responder, ZMQ_SNDTIMEO, &timeout, sizeof(timeout));
char addr[22];
snprintf(addr, sizeof(addr), "tcp://localhost:%d", port);
@@ -98,23 +102,13 @@ void* workerFunc(void *args){
key_value_pair *head = NULL;
key_value_pair *tail = NULL;
char request[MESSAGE_LENGTH + 1] = {0};
char request[MESSAGE_LENGTH] = {0};
int bytes_recv = zmq_recv(responder, request, MESSAGE_LENGTH, 0);
if(bytes_recv < 3){ // minimal receive is TYPE
// perror("Failed to receive valid request");
continue;
}
request[bytes_recv] = '\0';
/*
char endpoint[256];
size_t endpoint_size = sizeof(endpoint);
if (zmq_getsockopt(responder, ZMQ_LAST_ENDPOINT, endpoint, &endpoint_size) == 0) {
// fprintf(stderr, "Got request on: %s\n", endpoint);
}
*/
// fprintf(stderr, "Received: %s\n", request);
const TYPE type = get_request_type(request);