Skip to content

Commit

Permalink
Bind error EADDRINUSE was not handled, #895
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Feb 16, 2017
1 parent 570c82b commit 7aa080e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ int listen_on_port(char *ip, uint16_t port, int backlog, bool reuseport) {
#endif /* SO_REUSEPORT */

if (bind(sd, next->ai_addr, next->ai_addrlen) == -1) {
if (errno != EADDRINUSE) {
proxy_error("bind(): %s\n", gai_strerror(errno));
//if (errno != EADDRINUSE) {
proxy_error("bind(): %s\n", strerror(errno));
close(sd);
freeaddrinfo(ai);
return -1;
}
//}
} else {
if (listen(sd, backlog) == -1) {
proxy_error("listen(): %s\n", gai_strerror(errno));
proxy_error("listen(): %s\n", strerror(errno));
close(sd);
freeaddrinfo(ai);
return -1;
Expand Down

0 comments on commit 7aa080e

Please sign in to comment.