mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Shrink code lines and reduce code cyclomatic complexity (#8748)
code cleanup in anetGenericAccept
This commit is contained in:
parent
761d7d2771
commit
5f6e166bce
@ -493,18 +493,13 @@ int anetUnixServer(char *err, char *path, mode_t perm, int backlog)
|
|||||||
|
|
||||||
static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *len) {
|
static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *len) {
|
||||||
int fd;
|
int fd;
|
||||||
while(1) {
|
do {
|
||||||
fd = accept(s,sa,len);
|
fd = accept(s,sa,len);
|
||||||
|
} while(fd == -1 && errno == EINTR);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
if (errno == EINTR)
|
|
||||||
continue;
|
|
||||||
else {
|
|
||||||
anetSetError(err, "accept: %s", strerror(errno));
|
anetSetError(err, "accept: %s", strerror(errno));
|
||||||
return ANET_ERR;
|
return ANET_ERR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user