MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / disconnect

Method disconnect

source/network/ODSocketClient.cpp:61–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void ODSocketClient::disconnect(bool keepReplay)
62{
63 mPendingTimestamp = -1;
64 ODSource src = mSource;
65 mSource = ODSource::none;
66 switch(src)
67 {
68 case ODSource::none:
69 {
70 // Nothing to do
71 return;
72 }
73 case ODSource::network:
74 {
75 // Remove any remaining client sockets from the socket selector,
76 // if there is any left.
77 mSockSelector.clear();
78 mSockClient.disconnect();
79 break;
80 }
81 case ODSource::file:
82 {
83 mReplayInputStream.close();
84 return;
85 }
86 default:
87 assert(false);
88 break;
89 }
90
91 mReplayOutputStream.close();
92 // Delete the replay newly created if asked to.
93 if (!keepReplay)
94 boost::filesystem::remove(mOutputReplayFilename);
95 mOutputReplayFilename.clear();
96}
97
98bool ODSocketClient::isDataAvailable()
99{

Callers 1

connectMethod · 0.45

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected