From 8842fca7eb73d110a1dfe26c691ec76270e58455 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 6 Jun 2024 08:44:24 -0700 Subject: [PATCH] small changes --- apps/self-test/stress-test.c | 14 ++++++++++++-- src/woofc-mqtt-gateway.c | 21 --------------------- src/woofc.cpp | 2 ++ 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/apps/self-test/stress-test.c b/apps/self-test/stress-test.c index bf862e19..4cd4d1d0 100644 --- a/apps/self-test/stress-test.c +++ b/apps/self-test/stress-test.c @@ -80,10 +80,10 @@ void *PutThread(void *arg) while(PutRemaining > 0) { PutRemaining--; gettimeofday(&st->posted,NULL); -//printf("Put: pr: %d\n",PutRemaining); +//printf("Put [%ld]: pr: %d\n",pthread_self(),PutRemaining); pthread_mutex_unlock(&Plock); seq_no = WooFPut(Iname,"stress_handler",st); -//printf("Put: seq_no: %ld\n",seq_no); +//printf("Put [%ld]: seq_no: %ld\n",pthread_self(),seq_no); if(WooFInvalid(seq_no)) { fprintf(stderr,"put thread failed\n"); fflush(stderr); @@ -264,6 +264,16 @@ int main(int argc, char **argv) pthread_mutex_init(&Glock,NULL); PutRemaining = size; +#if 0 + if(pt > size) { + pt = size; + } + + if(gt > size) { + gt = size; + } +#endif + // char Iname[4096]; // unsigned long seq_no; // MAKE_EXTENDED_NAME(Iname,Wname,"input"); diff --git a/src/woofc-mqtt-gateway.c b/src/woofc-mqtt-gateway.c index 32c001b9..914ebb24 100644 --- a/src/woofc-mqtt-gateway.c +++ b/src/woofc-mqtt-gateway.c @@ -664,26 +664,6 @@ printf("WooFProcessPut: called on %s with size %d\n",woof_name,copy_size); /* * use msgid to get back specific response */ -#ifdef FP - memset(sub_string,0,sizeof(sub_string)); - sprintf(sub_string,"/usr/bin/mosquitto_sub -c -i %d -q 1 -W %d -C 1 -h %s -t %s.%d -u \'%s\' -P \'%s\'", - msgid, - Timeout, - Broker, - Device_name_space, - msgid, - User_name, - Password); -printf("sub_string: %s\n",sub_string); - fd = popen(sub_string,"r"); - if(fd == NULL) { - fprintf(stderr,"WooFProcessPut: open for %s failed\n",sub_string); - free(element); - free(element_string); - seq_no = -1; - goto out; - } -#else RESP *rs; rs = MakeRESP(msgid); if(rs == NULL) { @@ -694,7 +674,6 @@ printf("sub_string: %s\n",sub_string); goto out; } -#endif /* * create the mqtt message to put to the device */ diff --git a/src/woofc.cpp b/src/woofc.cpp index f6ed692a..f59267d7 100644 --- a/src/woofc.cpp +++ b/src/woofc.cpp @@ -253,6 +253,8 @@ WOOF* WooFOpen(const char* name) { mio = MIOReOpen(local_name); if (mio == NULL) { + fprintf(stderr, "WooFOpen: reopen woof: %s failed\n", local_name); + fflush(stderr); return (NULL); } DEBUG_LOG("WooFOpen: opened %s\n", local_name);