瀏覽代碼

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) {