MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / Destroy

Method Destroy

src/network/network_server.cpp:106–119  ·  view source on GitHub ↗

* Begin the destruction of this packet writer. It can happen in two ways: * in the first case the client disconnected while saving the map. In this * case the saving has not finished and killed this PacketWriter. In that * case we simply set cs to nullptr, triggering the appending to fail due to * the connection problem and eventually triggering the destructor. In the * second case the d

Source from the content-addressed store, hash-verified

104 * destructor.
105 */
106 void Destroy()
107 {
108 std::unique_lock<std::mutex> lock(this->mutex);
109
110 this->cs = nullptr;
111
112 this->exit_sig.notify_all();
113 lock.unlock();
114
115 /* Make sure the saving is completely cancelled. Yes,
116 * we need to handle the save finish as well as the
117 * next connection might just be requesting a map. */
118 WaitTillSaved();
119 }
120
121 /**
122 * Transfer all packets from here to the network's queue while holding

Callers 3

CloseConnectionMethod · 0.45
SendMapMethod · 0.45

Calls 1

WaitTillSavedFunction · 0.85

Tested by

no test coverage detected