X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=net.c;fp=net.c;h=b9176a6659d6d2628aff3f71f9d82718e0e7a802;hb=1319d78c9a00faf49f6104ab8c2813558367e442;hp=3f76d21c6cc9abf60ff5a98d1ac804f4b067ffef;hpb=2b004fc5dc0c652c6eb4daf84e5875f2c852ca72;p=paraslash.git diff --git a/net.c b/net.c index 3f76d21c..b9176a66 100644 --- a/net.c +++ b/net.c @@ -425,15 +425,20 @@ int makesock_addrinfo(unsigned l4type, bool passive, struct addrinfo *ai, for (; ai; ai = ai->ai_next) { int fd; ret = socket(ai->ai_family, sock_type(l4type), l4type); - if (ret < 0) + if (ret < 0) { + PARA_NOTICE_LOG("socket(): %s\n", strerror(errno)); continue; + } fd = ret; flowopt_setopts(fd, fo); if (!passive) { - if (connect(fd, ai->ai_addr, ai->ai_addrlen) == 0) - return fd; - close(fd); - continue; + if (connect(fd, ai->ai_addr, ai->ai_addrlen) < 0) { + PARA_NOTICE_LOG("connect(): %s\n", + strerror(errno)); + close(fd); + continue; + } + return fd; } /* * Reuse the address on passive sockets to avoid failure on @@ -442,10 +447,12 @@ int makesock_addrinfo(unsigned l4type, bool passive, struct addrinfo *ai, */ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) { + PARA_NOTICE_LOG("setsockopt(): %s\n", strerror(errno)); close(fd); continue; } if (bind(fd, ai->ai_addr, ai->ai_addrlen) < 0) { + PARA_NOTICE_LOG("bind(): %s\n", strerror(errno)); close(fd); continue; }