Skip to content

Commit 2198378

Browse files
committed
Fix connection cannot be forcibly closed
1 parent 679bcba commit 2198378

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/server/process.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ bool ProcessFactory::finish(SendData *resp) {
205205
resp->info.len,
206206
session_id);
207207
return false;
208-
} else if (conn->overflow) {
208+
} else if (conn->overflow &&
209+
(resp->info.type == SW_SERVER_EVENT_SEND_DATA && resp->info.type == SW_SERVER_EVENT_SEND_FILE)) {
209210
if (server_->send_yield && process_is_supported_send_yield(server_, conn)) {
210211
swoole_set_last_error(SW_ERROR_OUTPUT_SEND_YIELD);
211212
} else {

src/server/reactor_thread.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,7 @@ void Server::start_heartbeat_thread() {
10551055
ev.type = SW_SERVER_EVENT_CLOSE_FORCE;
10561056
// convert fd to session_id, in order to verify the connection before the force close connection
10571057
ev.fd = session_id;
1058-
Socket *_pipe_sock = get_reactor_pipe_socket(session_id, conn->reactor_id);
1059-
_pipe_sock->send_blocking((void *) &ev, sizeof(ev));
1058+
get_reactor_pipe_socket(session_id, conn->reactor_id)->send_blocking(&ev, sizeof(ev));
10601059
});
10611060
sleep(heartbeat_check_interval);
10621061
}

0 commit comments

Comments
 (0)