Use switch-case instead of if
This commit is contained in:
parent
3931a0b04d
commit
225b90eefd
|
@ -370,17 +370,18 @@ void perform_accept_pending_connection(ListenHandler *listener_handler,
|
||||||
auto fd = accept(server_fd, &sockaddr.sa, &addrlen);
|
auto fd = accept(server_fd, &sockaddr.sa, &addrlen);
|
||||||
|
|
||||||
if(fd == -1) {
|
if(fd == -1) {
|
||||||
if(errno == EINTR ||
|
switch(errno) {
|
||||||
errno == ENETDOWN ||
|
case EINTR:
|
||||||
errno == EPROTO ||
|
case ENETDOWN:
|
||||||
errno == ENOPROTOOPT ||
|
case EPROTO:
|
||||||
errno == EHOSTDOWN ||
|
case ENOPROTOOPT:
|
||||||
|
case EHOSTDOWN:
|
||||||
#ifdef ENONET
|
#ifdef ENONET
|
||||||
errno == ENONET ||
|
case ENONET:
|
||||||
#endif // ENONET
|
#endif // ENONET
|
||||||
errno == EHOSTUNREACH ||
|
case EHOSTUNREACH:
|
||||||
errno == EOPNOTSUPP ||
|
case EOPNOTSUPP:
|
||||||
errno == ENETUNREACH) {
|
case ENETUNREACH:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue