mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Sockets: Always try to send MSG_NOSIGNAL in peer().send()
Fixes RASocket::authenticate crash "MSG_NOSIGNAL: If you send() to a remote host which is no longer recv()ing, you'll typically get the signal SIGPIPE. Adding this flag prevents that signal from being raised." Closes #5040 Thanks to @derex for the hint
This commit is contained in:
@@ -138,7 +138,11 @@ ssize_t RealmSocket::noblk_send(ACE_Message_Block &message_block)
|
||||
return -1;
|
||||
|
||||
// Try to send the message directly.
|
||||
#ifdef MSG_NOSIGNAL
|
||||
ssize_t n = peer().send(message_block.rd_ptr(), len, MSG_NOSIGNAL);
|
||||
#else
|
||||
ssize_t n = peer().send(message_block.rd_ptr(), len);
|
||||
#endif // MSG_NOSIGNAL
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
|
||||
@@ -372,9 +372,9 @@ int WorldSocket::handle_output_queue (GuardType& g)
|
||||
const size_t send_len = mblk->length();
|
||||
|
||||
#ifdef MSG_NOSIGNAL
|
||||
ssize_t n = peer().send (mblk->rd_ptr(), send_len, MSG_NOSIGNAL);
|
||||
ssize_t n = peer().send(mblk->rd_ptr(), send_len, MSG_NOSIGNAL);
|
||||
#else
|
||||
ssize_t n = peer().send (mblk->rd_ptr(), send_len);
|
||||
ssize_t n = peer().send(mblk->rd_ptr(), send_len);
|
||||
#endif // MSG_NOSIGNAL
|
||||
|
||||
if (n == 0)
|
||||
|
||||
@@ -336,7 +336,12 @@ int RASocket::subnegotiate()
|
||||
|
||||
//! Just send back end of subnegotiation packet
|
||||
uint8 const reply[2] = {0xFF, 0xF0};
|
||||
|
||||
#ifdef MSG_NOSIGNAL
|
||||
return int(peer().send(reply, 2, MSG_NOSIGNAL));
|
||||
#else
|
||||
return int(peer().send(reply, 2));
|
||||
#endif // MSG_NOSIGNAL
|
||||
}
|
||||
|
||||
int RASocket::svc(void)
|
||||
|
||||
Reference in New Issue
Block a user