]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
use config only in client
authorBastian Dehn <hhaalo@arcor.de>
Sat, 18 May 2024 09:03:13 +0000 (11:03 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 18 May 2024 09:11:45 +0000 (11:11 +0200)
src/kds_s2000w_client.c
src/kds_s2000w_heartbeat.c
src/kds_s2000w_heartbeat.h

index 16f67146e73791d5a7d5d02426b3dbe1c1758cb9..4f4a4692d4aa8c92edebfcddf004e01ee29ab610 100644 (file)
@@ -171,7 +171,7 @@ int kds_s2000w_client_status_session(int64_t sessionid, response* response)
 {
        debug_printf(ALL, "kds_s2000w_client_status_session");
        join_thread();
-       wait_a_second();
+       wait_seconds(&p_config.heartbeat);
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        struct curl_slist* headers = NULL;
index 08ac1ec90f5a792a43a506689824b480e5401b8c..19b0d8af983901d2865dd1faa25e303cd31a59db 100644 (file)
@@ -1,14 +1,13 @@
 #include <unistd.h>
 #include <pthread.h>
-#include "config.h"
-#include "kds_s2000w_config.h"
 #include "kds_s2000w_heartbeat.h"
 
 pthread_t pwait;
 
 void* _wait_thread(void *args)
 {
-       sleep(p_config.heartbeat);
+       unsigned int* seconds = (unsigned int*) args;
+       sleep(*seconds);
        return NULL;
 }
 
@@ -17,7 +16,7 @@ void join_thread()
        pthread_join(pwait, NULL);
 }
 
-void wait_a_second()
+void wait_seconds(unsigned int* seconds)
 {
-       pthread_create(&pwait, NULL, _wait_thread, NULL);
+       pthread_create(&pwait, NULL, _wait_thread, seconds);
 }
\ No newline at end of file
index 982b95be36ce10db48c0fbe0292ed4d937bd22f8..cafff2b9fe45ec7811fb840540fe73b5e504fbd5 100644 (file)
@@ -2,6 +2,6 @@
 #define KDS_S2000W_HEARTBEAT_H
 
 void join_thread();
-void wait_a_second();
+void wait_seconds(unsigned int* seconds);
 
 #endif
\ No newline at end of file