diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2023-07-18 08:49:46 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2023-07-18 08:49:46 +0200 |
| commit | 55d9cd75679050b45f1b350decb95d05aac2a47e (patch) | |
| tree | 43ab7b3939745ef8f6b6e072ec835a47f075da54 | |
| parent | 29ff963194bc5c93be12f69d253edc9052671efa (diff) | |
Minor changes
| -rw-r--r-- | src/logger.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/logger.c b/src/logger.c index 2aa565b..7655f75 100644 --- a/src/logger.c +++ b/src/logger.c @@ -29,7 +29,7 @@ void sighandler(int signo){ } } -void *publish(void *publisher); +void *publisher(void *zmq_publisher); typedef struct queue { int size; @@ -75,11 +75,11 @@ int main (int argc, char *argv []) } //----- Prepare our context and publisher - void *context = zmq_ctx_new (); - void *publisher = zmq_socket (context, ZMQ_PUB); + void *zmq_context = zmq_ctx_new (); + void *zmq_publisher = zmq_socket (zmq_context, ZMQ_PUB); char bindto[STATIC_LEN]; sprintf(bindto,"tcp://%s:%d",__ip,__port); - int rc = zmq_connect (publisher, bindto); + int rc = zmq_connect (zmq_publisher, bindto); if(rc!=0){ printf("Failed to connect to %s\n",bindto); exit(1); @@ -104,7 +104,7 @@ int main (int argc, char *argv []) for(int i=0;i<MAX_QUEUES;i++){ queues[queue_id].issending=0; } - pthread_create(&zmq_thread, NULL, publish, publisher); + pthread_create(&zmq_thread, NULL, publisher, zmq_publisher); while(!__stop){ interval=INTERVAL(__loginterval); @@ -144,18 +144,18 @@ int main (int argc, char *argv []) fclose(regptr); pthread_join(zmq_thread, NULL); - zmq_close (publisher); - zmq_ctx_destroy (context); + zmq_close (zmq_publisher); + zmq_ctx_destroy (zmq_context); return 0; } -void *publish(void *publisher){ +void *publisher(void *zmq_publisher){ int queue_id=0; while(!__stop){ if(queues[queue_id].issending){ printf("Publishing..."); - zmq_send(publisher,queues[queue_id].msg,queues[queue_id].size,0); + zmq_send(zmq_publisher,queues[queue_id].msg,queues[queue_id].size,0); queues[queue_id].issending=0; printf("done\n"); } else { |
