* 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
| 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 |
no test coverage detected