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

Method Finish

src/network/network_server.cpp:166–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

SlErrorFunction · 0.85
push_backMethod · 0.80
Send_uint32Method · 0.80

Tested by

no test coverage detected