MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / Disconnect

Method Disconnect

extensions/olcPGEX_Network.h:743–760  ·  view source on GitHub ↗

Disconnect from server

Source from the content-addressed store, hash-verified

741
742 // Disconnect from server
743 void Disconnect()
744 {
745 // If connection exists, and it's connected then...
746 if(IsConnected())
747 {
748 // ...disconnect from server gracefully
749 m_connection->Disconnect();
750 }
751
752 // Either way, we're also done with the asio context...
753 m_context.stop();
754 // ...and its thread
755 if (thrContext.joinable())
756 thrContext.join();
757
758 // Destroy the connection object
759 m_connection.release();
760 }
761
762 // Check if client is actually connected to a server
763 bool IsConnected()

Callers

nothing calls this directly

Calls 1

DisconnectMethod · 0.45

Tested by

no test coverage detected