Better half time
This commit is contained in:
+5
-11
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user