V69+: Change DBG_ALWAYS to DBG_USER for expected socket events
authorjoan2937 <joan@abyz.me.uk>
Sun, 7 Jul 2019 08:58:43 +0000 (09:58 +0100)
committerjoan2937 <joan@abyz.me.uk>
Sun, 7 Jul 2019 08:58:43 +0000 (09:58 +0100)
pigpio.c
pigpio.h

index 56c348966e6171bf5fdf88712c27081627beed8d..282e80051352553fda40a0db8b36d6e7f6508db1 100644 (file)
--- a/pigpio.c
+++ b/pigpio.c
@@ -6982,8 +6982,8 @@ static void *pthSocketThreadHandler(void *fdC)
          else
          {
             /* Serious error.  No point continuing. */
-            DBG(DBG_ALWAYS,
-               "ext too large %"PRIdPTR"(%zd), sock=%d", p[3], sizeof(buf), sock);
+            DBG(DBG_ALWAYS, "ext too large %"PRIdPTR"(%zd), sock=%d",
+               p[3], sizeof(buf), sock);
 
             closeOrphanedNotifications(-1, sock);
 
@@ -7061,7 +7061,7 @@ static void *pthSocketThreadHandler(void *fdC)
 
    close(sock);
 
-   DBG(DBG_ALWAYS, "Socket %d closed", sock);
+   DBG(DBG_USER, "Socket %d closed", sock);
 
    return 0;
 }
@@ -7126,7 +7126,7 @@ static void * pthSocketThread(void *x)
 
       if (addrAllowed((struct sockaddr *)&client))
       {
-         DBG(DBG_ALWAYS, "Connection accepted on socket %d", fdC);
+         DBG(DBG_USER, "Connection accepted on socket %d", fdC);
 
          sock = malloc(sizeof(int));
 
@@ -7136,12 +7136,13 @@ static void * pthSocketThread(void *x)
          int optval = 1;
          socklen_t optlen = sizeof(optval);
 
-         if (setsockopt(fdC, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) < 0) {
-           DBG(0, "setsockopt() fail, closing socket %d", fdC);
+         if (setsockopt(fdC, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) < 0)
+         {
+           DBG(DBG_ALWAYS, "setsockopt() fail, closing socket %d", fdC);
            close(fdC);
          }
 
-         DBG(DBG_ALWAYS, "SO_KEEPALIVE enabled on socket %d\n", fdC);
+         DBG(DBG_USER, "SO_KEEPALIVE enabled on socket %d\n", fdC);
 
          if (pthread_create
             (&thr, &attr, pthSocketThreadHandler, (void*) sock) < 0)
index 8459509f743a8919521085d51fccf7f592482a71..b61c5034fe210539e4900787a57b5d6c09daf661 100644 (file)
--- a/pigpio.h
+++ b/pigpio.h
@@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
 #include <stdint.h>
 #include <pthread.h>
 
-#define PIGPIO_VERSION 69
+#define PIGPIO_VERSION 6901
 
 /*TEXT