| 164 | } |
| 165 | |
| 166 | void Finish() override |
| 167 | { |
| 168 | std::lock_guard<std::mutex> lock(this->mutex); |
| 169 | |
| 170 | /* We want to abort the saving when the socket is closed. */ |
| 171 | if (this->cs == nullptr) SlError(STR_NETWORK_ERROR_LOSTCONNECTION); |
| 172 | |
| 173 | /* Make sure the last packet is flushed. */ |
| 174 | if (this->current != nullptr) this->packets.push_back(std::move(this->current)); |
| 175 | |
| 176 | /* Add a packet stating that this is the end to the queue. */ |
| 177 | this->packets.push_back(std::make_unique<Packet>(this->cs, PACKET_SERVER_MAP_DONE)); |
| 178 | |
| 179 | /* Fast-track the size to the client. */ |
| 180 | auto p = std::make_unique<Packet>(this->cs, PACKET_SERVER_MAP_SIZE); |
| 181 | p->Send_uint32((uint32_t)this->total_size); |
| 182 | this->packets.push_front(std::move(p)); |
| 183 | } |
| 184 | }; |
| 185 | |
| 186 |
nothing calls this directly
no test coverage detected