Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit597e2ee

Browse files
committed
Increase socket buffer size
1 parentae0efde commit597e2ee

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

‎contrib/multimaster/dtmd/include/limits.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
#defineBUFFER_SIZE (256 * 1024)
77
#defineLISTEN_QUEUE_SIZE 100
88
#defineMAX_STREAMS 4096
9+
#defineSOCKET_BUFFER_SIZE (16*1024*1024)
910

1011
#endif

‎contrib/multimaster/dtmd/src/server.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ static int create_listening_socket(const char *host, int port) {
8181
intoptval=1;
8282
setsockopt(s,IPPROTO_TCP,TCP_NODELAY, (charconst*)&optval,sizeof(optval));
8383
setsockopt(s,SOL_SOCKET,SO_REUSEADDR, (charconst*)&optval,sizeof(optval));
84+
optval=SOCKET_BUFFER_SIZE;
85+
setsockopt(s,SOL_SOCKET,SO_SNDBUF, (constchar*)&optval,sizeof(int));
86+
optval=SOCKET_BUFFER_SIZE;
87+
setsockopt(s,SOL_SOCKET,SO_RCVBUF, (constchar*)&optval,sizeof(int));
8488

8589
structsockaddr_inaddr;
8690
addr.sin_family=AF_INET;

‎contrib/multimaster/sockhub/sockhub.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include"sockhub.h"
2121

22+
constsize_tSOCKHUB_BUFFER_SIZE (16*1024*1024)
23+
2224
voidShubAddSocket(Shub*shub,intfd);
2325

2426
inlinevoidShubAddSocket(Shub*shub,intfd)
@@ -189,6 +191,10 @@ static void reconnect(Shub* shub)
189191
}else {
190192
intoptval=1;
191193
setsockopt(shub->output,IPPROTO_TCP,TCP_NODELAY, (charconst*)&optval,sizeof(optval));
194+
optval=SOCKHUB_BUFFER_SIZE;
195+
setsockopt(shub->output,SOL_SOCKET,SO_SNDBUF, (constchar*)&optval,sizeof(int));
196+
optval=SOCKHUB_BUFFER_SIZE;
197+
setsockopt(shub->output,SOL_SOCKET,SO_RCVBUF, (constchar*)&optval,sizeof(int));
192198

193199
ShubAddSocket(shub,shub->output);
194200
if (sep!=NULL) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp