Преглед изворни кода

cdp: log message when failing to set nonblock on socket

Daniel-Constantin Mierla пре 2 година
родитељ
комит
88bcd44e07
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      src/modules/cdp/receiver.c

+ 3 - 1
src/modules/cdp/receiver.c

@@ -949,7 +949,9 @@ int peer_connect(peer *p)
 		{ // Connect with timeout
 			int x;
 			x = fcntl(sock, F_GETFL, 0);
-			fcntl(sock, F_SETFL, x | O_NONBLOCK);
+			if(fcntl(sock, F_SETFL, x | O_NONBLOCK) < 0) {
+				LM_WARN("failed to set O_NONBLOCK on socket %d\n", sock);
+			}
 			int res = connect(sock, ainfo->ai_addr, ainfo->ai_addrlen);
 			if(res < 0) {
 				if(errno == EINPROGRESS) {