fix socket half close (#1263)

Co-authored-by: zixun <lvzxiun@gmail.com>
This commit is contained in:
子熏
2020-12-03 15:47:51 +08:00
committed by GitHub
parent 693b962b43
commit 56c70dc7ac

View File

@@ -1357,8 +1357,14 @@ forward_message_tcp(struct socket_server *ss, struct socket *s, struct socket_lo
}
if (n==0) {
FREE(buffer);
force_close(ss, s, l, result);
return SOCKET_CLOSE;
if (nomore_sending_data(s)) {
force_close(ss,s,l,result);
return SOCKET_CLOSE;
} else {
s->type = SOCKET_TYPE_HALFCLOSE;
shutdown(s->fd, SHUT_RD);
return -1;
}
}
if (s->type == SOCKET_TYPE_HALFCLOSE) {