MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / sendPackets

Method sendPackets

source/game/StarNetPacketSocket.cpp:89–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void LocalPacketSocket::sendPackets(List<PacketPtr> packets) {
90 if (!isOpen() || packets.empty())
91 return;
92
93 if (auto outgoingPipe = m_outgoingPipe.lock()) {
94 MutexLocker locker(outgoingPipe->mutex);
95
96#ifdef STAR_DEBUG
97 // Test serialization if STAR_DEBUG is enabled
98 DataStreamBuffer buffer;
99 for (auto inPacket : take(packets)) {
100 buffer.clear();
101 inPacket->write(buffer);
102 auto outPacket = createPacket(inPacket->type());
103 buffer.seek(0);
104 outPacket->read(buffer);
105 packets.append(outPacket);
106 }
107#endif
108
109 outgoingPipe->queue.appendAll(std::move(packets));
110 }
111}
112
113List<PacketPtr> LocalPacketSocket::receivePackets() {
114 MutexLocker locker(m_incomingPipe->mutex);

Callers 14

setPauseMethod · 0.45
setTimescaleMethod · 0.45
updatePlanetTypeMethod · 0.45
sendPacketMethod · 0.45
sendPendingChatMethod · 0.45
sendClockUpdatesMethod · 0.45
warpPlayersMethod · 0.45
worldUpdatedMethod · 0.45
systemWorldUpdatedMethod · 0.45
acceptConnectionMethod · 0.45

Calls 15

takeFunction · 0.85
createPacketFunction · 0.85
makeSMutableIteratorFunction · 0.85
compressDataFunction · 0.85
appendAllMethod · 0.80
writeVlqIMethod · 0.80
compressionModeMethod · 0.80
compressMethod · 0.80
emptyMethod · 0.45
lockMethod · 0.45
clearMethod · 0.45

Tested by 1

TESTFunction · 0.36