Skip to content

Commit

Permalink
Fix connection cannot be forcibly closed
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Oct 9, 2021
1 parent 679bcba commit 2198378
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/server/process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ bool ProcessFactory::finish(SendData *resp) {
resp->info.len,
session_id);
return false;
} else if (conn->overflow) {
} else if (conn->overflow &&
(resp->info.type == SW_SERVER_EVENT_SEND_DATA && resp->info.type == SW_SERVER_EVENT_SEND_FILE)) {
if (server_->send_yield && process_is_supported_send_yield(server_, conn)) {
swoole_set_last_error(SW_ERROR_OUTPUT_SEND_YIELD);
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/server/reactor_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,7 @@ void Server::start_heartbeat_thread() {
ev.type = SW_SERVER_EVENT_CLOSE_FORCE;
// convert fd to session_id, in order to verify the connection before the force close connection
ev.fd = session_id;
Socket *_pipe_sock = get_reactor_pipe_socket(session_id, conn->reactor_id);
_pipe_sock->send_blocking((void *) &ev, sizeof(ev));
get_reactor_pipe_socket(session_id, conn->reactor_id)->send_blocking(&ev, sizeof(ev));
});
sleep(heartbeat_check_interval);
}
Expand Down

0 comments on commit 2198378

Please sign in to comment.