mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
fix halfclose bug, See detail #1358
This commit is contained in:
@@ -269,8 +269,8 @@ function socket.close(id)
|
|||||||
if s == nil then
|
if s == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
driver.close(id)
|
||||||
if s.connected then
|
if s.connected then
|
||||||
driver.close(id)
|
|
||||||
if s.co then
|
if s.co then
|
||||||
-- reading this socket on another coroutine, so don't shutdown (clear the buffer) immediately
|
-- reading this socket on another coroutine, so don't shutdown (clear the buffer) immediately
|
||||||
-- wait reading coroutine read the buffer.
|
-- wait reading coroutine read the buffer.
|
||||||
|
|||||||
@@ -1024,7 +1024,7 @@ send_socket(struct socket_server *ss, struct request_send * request, struct sock
|
|||||||
so.free_func((void *)request->buffer);
|
so.free_func((void *)request->buffer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (send_buffer_empty(s) && type == SOCKET_TYPE_CONNECTED) {
|
if (send_buffer_empty(s)) {
|
||||||
if (s->protocol == PROTOCOL_TCP) {
|
if (s->protocol == PROTOCOL_TCP) {
|
||||||
append_sendbuffer(ss, s, request); // add to high priority list, even priority == PRIORITY_LOW
|
append_sendbuffer(ss, s, request); // add to high priority list, even priority == PRIORITY_LOW
|
||||||
} else {
|
} else {
|
||||||
@@ -1148,8 +1148,9 @@ close_socket(struct socket_server *ss, struct request_close *request, struct soc
|
|||||||
int r = shutdown_read ? -1 : SOCKET_CLOSE;
|
int r = shutdown_read ? -1 : SOCKET_CLOSE;
|
||||||
force_close(ss,s,&l,result);
|
force_close(ss,s,&l,result);
|
||||||
return r;
|
return r;
|
||||||
} else if (!shutdown_read) {
|
}
|
||||||
s->closing = true;
|
s->closing = true;
|
||||||
|
if (!shutdown_read) {
|
||||||
// don't read socket after socket.close()
|
// don't read socket after socket.close()
|
||||||
close_read(ss, s, result);
|
close_read(ss, s, result);
|
||||||
return SOCKET_CLOSE;
|
return SOCKET_CLOSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user