Browse Source

Sending to a broken socket will no longer cause SIGPIPE signal to be sent back on most *nix systems (those supporting MSG_NOSIGNAL flag) (bugreport:5224)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15415 54d463be-8e91-2dee-dedb-b68131a5f0ec
gepard1984 13 năm trước cách đây
mục cha
commit
5b66b21b67
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      src/common/socket.c

+ 5 - 1
src/common/socket.c

@@ -194,6 +194,10 @@ int sSocket(int af, int type, int protocol)
 #endif
 /////////////////////////////////////////////////////////////////////
 
+#ifndef MSG_NOSIGNAL
+	#define MSG_NOSIGNAL 0
+#endif
+
 fd_set readfds;
 int fd_max;
 time_t last_tick;
@@ -340,7 +344,7 @@ int send_from_fifo(int fd)
 	if( session[fd]->wdata_size == 0 )
 		return 0; // nothing to send
 
-	len = sSend(fd, (const char *) session[fd]->wdata, (int)session[fd]->wdata_size, 0);
+	len = sSend(fd, (const char *) session[fd]->wdata, (int)session[fd]->wdata_size, MSG_NOSIGNAL);
 
 	if( len == SOCKET_ERROR )
 	{//An exception has occured