From e41362f24382bdfde217bcc80e6844c5b57176f1 Mon Sep 17 00:00:00 2001 From: joan2937 Date: Sun, 7 Jul 2019 09:58:43 +0100 Subject: [PATCH] V69+: Change DBG_ALWAYS to DBG_USER for expected socket events --- pigpio.c | 15 ++++++++------- pigpio.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pigpio.c b/pigpio.c index 56c3489..282e800 100644 --- 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) diff --git a/pigpio.h b/pigpio.h index 8459509..b61c503 100644 --- a/pigpio.h +++ b/pigpio.h @@ -31,7 +31,7 @@ For more information, please refer to #include #include -#define PIGPIO_VERSION 69 +#define PIGPIO_VERSION 6901 /*TEXT -- 2.30.2