diff options
author | nat-goodspeed <nat@lindenlab.com> | 2024-09-05 08:37:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-05 08:37:16 -0400 |
commit | 7ac4c3b56e5246fceaa73e7c9c665d3c04827d6c (patch) | |
tree | e96334bd9299102ebdaf229eec9cf4c2165f8c2f /indra/llmessage/net.cpp | |
parent | 487973d3f0ee9b8583b3d977ca6a405cba5fe518 (diff) | |
parent | 6a747e1ce027700a3609f4c377179bfa29c3ce31 (diff) |
Merge pull request #2450 from secondlife/lua-merge
Merge updated 'main' branch into release/luau-scripting
Diffstat (limited to 'indra/llmessage/net.cpp')
-rw-r--r-- | indra/llmessage/net.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index c8552b3fb4..1c49f9be36 100644 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -77,7 +77,7 @@ const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1"; const char* BROADCAST_ADDRESS_STRING = "255.255.255.255"; #if LL_DARWIN - // Mac OS X returns an error when trying to set these to 400000. Smaller values succeed. + // macOS returns an error when trying to set these to 400000. Smaller values succeed. const int SEND_BUFFER_SIZE = 200000; const int RECEIVE_BUFFER_SIZE = 200000; #else // LL_DARWIN @@ -338,8 +338,8 @@ S32 receive_packet(int hSocket, char * receiveBuffer) return nRet; } -// Returns TRUE on success. -BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort) +// Returns true on success. +bool send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort) { // Sends a packet to the address set in initNet // @@ -364,7 +364,7 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i // assume it is. JNC 2002.01.18 if (WSAECONNRESET == WSAGetLastError()) { - return TRUE; + return true; } LL_INFOS() << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort << ", Error " << last_error << LL_ENDL; @@ -598,11 +598,11 @@ int receive_packet(int hSocket, char * receiveBuffer) return nRet; } -BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, int nPort) +bool send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, int nPort) { int ret; - BOOL success; - BOOL resend; + bool success; + bool resend; S32 send_attempts = 0; stDstAddr.sin_addr.s_addr = recipient; @@ -616,34 +616,34 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, if (ret >= 0) { // successful send - success = TRUE; - resend = FALSE; + success = true; + resend = false; } else { // send failed, check to see if we should resend - success = FALSE; + success = false; if (errno == EAGAIN) { // say nothing, just repeat send LL_INFOS() << "sendto() reported buffer full, resending (attempt " << send_attempts << ")" << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = TRUE; + resend = true; } else if (errno == ECONNREFUSED) { // response to ICMP connection refused message on earlier send LL_INFOS() << "sendto() reported connection refused, resending (attempt " << send_attempts << ")" << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = TRUE; + resend = true; } else { // some other error LL_INFOS() << "sendto() failed: " << errno << ", " << strerror(errno) << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = FALSE; + resend = false; } } } @@ -652,7 +652,7 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, if (send_attempts >= 3) { LL_INFOS() << "sendPacket() bailed out of send!" << LL_ENDL; - return FALSE; + return false; } return success; |