MCPcopy Create free account
hub / github.com/cuberite/cuberite / ~cClientHandle

Method ~cClientHandle

src/ClientHandle.cpp:104–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104cClientHandle::~cClientHandle()
105{
106 ASSERT(m_State >= csDestroyedWaiting); // Has Destroy() been called?
107
108 LOGD("Deleting client \"%s\" at %p", GetUsername().c_str(), this);
109
110 {
111 cCSLock Lock(m_CSChunkLists);
112 m_LoadedChunks.clear();
113 m_ChunksToSend.clear();
114 }
115
116 if (m_Player != NULL)
117 {
118 cWorld * World = m_Player->GetWorld();
119 if (!m_Username.empty() && (World != NULL))
120 {
121 // Send the Offline PlayerList packet:
122 World->BroadcastPlayerListItem(*m_Player, false, this);
123 }
124 if (World != NULL)
125 {
126 World->RemovePlayer(m_Player);
127 m_Player->Destroy();
128 }
129 delete m_Player;
130 m_Player = NULL;
131 }
132
133 if (!m_HasSentDC)
134 {
135 SendDisconnect("Server shut down? Kthnxbai");
136 }
137
138 // Close the socket as soon as it sends all outgoing data:
139 cRoot::Get()->GetServer()->RemoveClient(this);
140
141 delete m_Protocol;
142 m_Protocol = NULL;
143
144 LOGD("ClientHandle at %p deleted", this);
145}
146
147
148

Callers

nothing calls this directly

Calls 9

c_strMethod · 0.80
clearMethod · 0.80
emptyMethod · 0.80
GetServerMethod · 0.80
GetWorldMethod · 0.45
RemovePlayerMethod · 0.45
DestroyMethod · 0.45
RemoveClientMethod · 0.45

Tested by

no test coverage detected