Skip to content

Commit

Permalink
Close socket before waiting for listening to stop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacquwes committed Sep 29, 2023
1 parent b3b0b4e commit dc2c62d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/server_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ namespace pine
if (std::this_thread::get_id() == listen_thread.get_id())
co_await switch_thread(listen_thread);

this->socket.close();

std::scoped_lock lock(connection_mutex);

std::cout << "[Server] Closing connection: " << std::dec << id << std::endl;

this->socket.close();

server_ref.disconnect_client(id);

std::cout << "[Server] Connection closed: " << std::dec << id << std::endl;
Expand Down

0 comments on commit dc2c62d

Please sign in to comment.