use RecvWaitAll outside of VehicleEvent.cpp as well

This commit is contained in:
Katharine Chui
2026-04-30 19:51:13 +02:00
parent f1ec753ca3
commit 809080c9aa
3 changed files with 4 additions and 3 deletions
+1
View File
@@ -56,3 +56,4 @@ void UDPClientMain(const std::string& IP, int Port);
void TCPGameServer(const std::string& IP, int Port); void TCPGameServer(const std::string& IP, int Port);
bool SecurityWarning(); bool SecurityWarning();
void CoreSend(std::string data); void CoreSend(std::string data);
int RecvWaitAll(int sockfd, char *buf, int len);
+2 -2
View File
@@ -143,7 +143,7 @@ void GetServerInfo(std::string Data) {
const std::string buffer = ([&]() -> std::string { const std::string buffer = ([&]() -> std::string {
int32_t Header; int32_t Header;
std::vector<char> data(sizeof(Header)); std::vector<char> data(sizeof(Header));
int Temp = recv(ISock, data.data(), sizeof(Header), MSG_WAITALL); int Temp = RecvWaitAll(ISock, data.data(), sizeof(Header));
auto checkBytes = ([&](const int32_t bytes) -> bool { auto checkBytes = ([&](const int32_t bytes) -> bool {
if (bytes == 0) { if (bytes == 0) {
@@ -164,7 +164,7 @@ void GetServerInfo(std::string Data) {
} }
data.resize(Header, 0); data.resize(Header, 0);
Temp = recv(ISock, data.data(), Header, MSG_WAITALL); Temp = RecvWaitAll(ISock, data.data(), Header);
if (!checkBytes(Temp)) { if (!checkBytes(Temp)) {
return ""; return "";
} }
+1 -1
View File
@@ -164,7 +164,7 @@ std::vector<char> TCPRcvRaw(SOCKET Sock, uint64_t& GRcv, uint64_t Size) {
do { do {
// receive at most some MB at a time // receive at most some MB at a time
int Len = std::min(int(Size - Rcv), 1 * 1024 * 1024); int Len = std::min(int(Size - Rcv), 1 * 1024 * 1024);
int Temp = recv(Sock, &File[Rcv], Len, MSG_WAITALL); int Temp = RecvWaitAll(Sock, &File[Rcv], Len);
if (Temp == -1 || Temp == 0) { if (Temp == -1 || Temp == 0) {
debug("Recv returned: " + std::to_string(Temp)); debug("Recv returned: " + std::to_string(Temp));
if (Temp == -1) { if (Temp == -1) {