Relatively graceful shutdowns

This commit is contained in:
2025-11-09 01:35:19 +01:00
parent 5312c4205c
commit 098afeb4d8
11 changed files with 154 additions and 30 deletions

View File

@@ -61,6 +61,8 @@ namespace ColumnLynx::Net::TCP {
void disconnect() {
std::string ip = mHandler->socket().remote_endpoint().address().to_string();
mHandler->sendMessage(ServerMessageType::GRACEFUL_DISCONNECT, "Server initiated disconnect.");
asio::error_code ec;
mHandler->socket().shutdown(asio::ip::tcp::socket::shutdown_both, ec);
mHandler->socket().close(ec);