Revert "nghttpx: Attempt to avoid TCP RST on socket closure on Linux"
This reverts commit f69b52b1aa
.
This commit is contained in:
parent
9b5ce36368
commit
26900262f3
|
@ -126,20 +126,7 @@ void Connection::disconnect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
// At least for Linux, shutdown both sides, and continue to read
|
shutdown(fd, SHUT_WR);
|
||||||
// until it gets EOF or error in order to avoid TCP RST.
|
|
||||||
shutdown(fd, SHUT_RDWR);
|
|
||||||
#ifdef __linux__
|
|
||||||
std::array<uint8_t, 16_k> b;
|
|
||||||
for (;;) {
|
|
||||||
ssize_t n;
|
|
||||||
while ((n = read(fd, b.data(), b.size())) == -1 && errno == EINTR)
|
|
||||||
;
|
|
||||||
if (n <= 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // __linux__
|
|
||||||
close(fd);
|
close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue