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

Method Send_bytes

src/network/core/packet.cpp:197–202  ·  view source on GitHub ↗

* Send as many of the bytes as possible in the packet. This can mean * that it is possible that not all bytes are sent. To cope with this * the function returns the span of bytes that were not sent. * @param span The span describing the range of bytes to send. * @return The span of bytes that were not written. */

Source from the content-addressed store, hash-verified

195 * @return The span of bytes that were not written.
196 */
197std::span<const uint8_t> Packet::Send_bytes(const std::span<const uint8_t> span)
198{
199 size_t amount = std::min<size_t>(span.size(), this->limit - this->Size());
200 this->buffer.insert(this->buffer.end(), span.data(), span.data() + amount);
201 return span.subspan(amount);
202}
203
204/*
205 * Receiving commands

Callers 6

SendRequestMethod · 0.80
SendResponseMethod · 0.80
SendEnableEncryptionMethod · 0.80
RequestContentListMethod · 0.80
WriteMethod · 0.80
SerializeGRFIdentifierFunction · 0.80

Calls 5

SizeMethod · 0.95
sizeMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected