Ignore Connection Aborted errors on accept (#29318)

* Ignore Connection Aborted errors on accept

* Reviewer comments
pull/29374/head
Yash Tibrewal 3 years ago committed by GitHub
parent 88a706eaac
commit 5850cba295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      src/core/lib/iomgr/tcp_server_posix.cc

@ -204,22 +204,22 @@ static void on_read(void* arg, grpc_error_handle err) {
strip off the ::ffff:0.0.0.0/96 prefix first. */
int fd = grpc_accept4(sp->fd, &addr, 1, 1);
if (fd < 0) {
switch (errno) {
case EINTR:
continue;
case EAGAIN:
grpc_fd_notify_on_read(sp->emfd, &sp->read_closure);
return;
default:
gpr_mu_lock(&sp->server->mu);
if (!sp->server->shutdown_listeners) {
gpr_log(GPR_ERROR, "Failed accept4: %s", strerror(errno));
} else {
/* if we have shutdown listeners, accept4 could fail, and we
needn't notify users */
}
gpr_mu_unlock(&sp->server->mu);
goto error;
if (errno == EINTR) {
continue;
} else if (errno == EAGAIN || errno == ECONNABORTED ||
errno == EWOULDBLOCK) {
grpc_fd_notify_on_read(sp->emfd, &sp->read_closure);
return;
} else {
gpr_mu_lock(&sp->server->mu);
if (!sp->server->shutdown_listeners) {
gpr_log(GPR_ERROR, "Failed accept4: %s", strerror(errno));
} else {
/* if we have shutdown listeners, accept4 could fail, and we
needn't notify users */
}
gpr_mu_unlock(&sp->server->mu);
goto error;
}
}

Loading…
Cancel
Save