Skip to content

Commit

Permalink
netsocket: explicitly reserve capacity for write queue upon flushing …
Browse files Browse the repository at this point in the history
…data to the socket

Signed-off-by: Pavel Solodovnikov <pavel.al.solodovnikov@gmail.com>
  • Loading branch information
ManManson authored and past-due committed Feb 8, 2025
1 parent 4339a0b commit 2407e2d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/netplay/tcp/netsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ void socketFlush(Socket& sock, uint8_t player, size_t *rawByteCount)
wzSemaphorePost(socketThreadSemaphore);
}
std::vector<uint8_t> &writeQueue = socketThreadWrites[&sock];
writeQueue.reserve(writeQueue.size() + compressionBuf.size());
writeQueue.insert(writeQueue.end(), compressionBuf.begin(), compressionBuf.end());
wzMutexUnlock(socketThreadMutex);

Expand Down

0 comments on commit 2407e2d

Please sign in to comment.