소스 검색

- The interserver outgoing buffer now gets flushed when it reaches 512KB of data stored on it.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11886 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 17 년 전
부모
커밋
11c0438e85
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      src/common/socket.c

+ 6 - 1
src/common/socket.c

@@ -210,9 +210,9 @@ int send_from_fifo(int fd)
 		return 0;
 	}
 
-	// some data could not be transferred?
 	if( len > 0 )
 	{
+		// some data could not be transferred?
 		// shift unsent data to the beginning of the queue
 		if( (size_t)len < session[fd]->wdata_size )
 			memmove(session[fd]->wdata, session[fd]->wdata + len, session[fd]->wdata_size - len);
@@ -507,6 +507,11 @@ int WFIFOSET(int fd, size_t len)
 	}
 
 	s->wdata_size += len;
+	//If the interserver has 200% of its normal size full, flush the data.
+	if(s->max_wdata >= FIFOSIZE_SERVERLINK &&
+		s->wdata_size >= 2*FIFOSIZE_SERVERLINK)
+		flush_fifo(fd);
+
 	// always keep a WFIFO_SIZE reserve in the buffer
 	// For inter-server connections, let the reserve be 1/4th of the link size.
 	newreserve = s->wdata_size + (s->max_wdata >= FIFOSIZE_SERVERLINK ? FIFOSIZE_SERVERLINK / 4 : WFIFO_SIZE);