]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
only use heartbeat in client
authorBastian Dehn <hhaalo@arcor.de>
Sun, 21 Apr 2024 06:37:16 +0000 (08:37 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 21 Apr 2024 06:37:16 +0000 (08:37 +0200)
src/kds_s2000w_client.c
src/kds_s2000w_config.c
src/kds_s2000w_config.h
src/kds_s2000w_handler.c
src/kds_s2000w_heartbeat.c

index d4ee876091ba94334347bb6b767f43aa93c70530..e6655205147d547c815141011818e74c4f493615 100644 (file)
@@ -2,11 +2,10 @@
 #include <stdlib.h>
 #include <curl/curl.h>
 #include "config.h"
+#include "kds_s2000w_config.h"
+#include "kds_s2000w_heartbeat.h"
 #include "kds_s2000w_client.h"
 #include "kds_s2000w_debug.h"
-#include "kds_s2000w_config.h"
-
-program_config p_config;
 
 void _kds_s2000w_client_read_error_status(CURL* curl, response* resp)
 {
@@ -171,6 +170,8 @@ void kds_s2000w_client_close_session(int64_t sessionid)
 int kds_s2000w_client_status_session(int64_t sessionid, response* response)
 {
        debug_printf(ALL, "kds_s2000w_client_status_session");
+       join_thread();
+       wait_a_second();
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        struct curl_slist* headers = NULL;
index b133b2f728f95e5fd5d23a3abc486154f2e2dac1..ecf72f865668e85c11a9cbbcfb7fc78c9e88a493 100644 (file)
@@ -3,6 +3,8 @@
 #include <confuse.h>
 #include "kds_s2000w_config.h"
 
+program_config p_config;
+
 char* read_config_file(const char* filename)
 {
        FILE* config_file = NULL;
index 918c5ef9c56ca13a6f1a2b2606d62f8f170a3c60..eb8a5ac1e892440f8504b9f2ff2150b9a0f17040 100644 (file)
@@ -7,6 +7,8 @@ typedef struct {
        unsigned int heartbeat;
 } program_config;
 
+extern program_config p_config;
+
 char* read_config_file(const char* filename);
 void load_config(program_config* config, const char* config_stream);
 #endif
\ No newline at end of file
index 4aeea918e49fd0aa56cf1dd8f734b4c6b99817d7..da021276893c830b9506b2d6638ffd5df9a64310 100644 (file)
@@ -7,7 +7,6 @@
 #include "kds_s2000w_client.h"
 #include "kds_s2000w_image_converter.h"
 #include "kds_s2000w_debug.h"
-#include "kds_s2000w_heartbeat.h"
 
 void _get_current_metadata(handler* h)
 {
@@ -146,8 +145,6 @@ void _get_current_scan_status(handler* h)
        if (h->current_scan_status->available_images > 1)
                return;
 
-       join_thread();
-       wait_a_second();
        resp = kds_s2000w_client_response_init();
        kds_s2000w_client_status_session(h->sessionid, resp);
        if (resp->error_size > 0)
@@ -214,7 +211,6 @@ handler* init_handler()
 void free_handler(handler* h)
 {
        debug_printf(ALL, "free handler");
-       join_thread();
        json_object_put(h->current_scanner_config);
        h->current_scanner_config = NULL;
        free(h->current_scan_status);
index 1dd7c28d6e78e3969ae7957e85fe4d6280ff39a6..08ac1ec90f5a792a43a506689824b480e5401b8c 100644 (file)
@@ -4,7 +4,6 @@
 #include "kds_s2000w_config.h"
 #include "kds_s2000w_heartbeat.h"
 
-extern program_config p_config;
 pthread_t pwait;
 
 void* _wait_thread(void *args)