mirror of
https://github.com/prirun/p50em.git
synced 2026-01-21 01:48:11 +00:00
devpnc.h: expand listen backlog for big rings, use TCP_DEFER_ACCEPT so
Linux holds onto connections until the uid is sent. Otherwise, the delay between making a connection and sending the uid will be larger than MAXACCCEPTTIME, causing large rings to fail
This commit is contained in:
parent
bf3c1a3df2
commit
120079666f
16
devpnc.h
16
devpnc.h
@ -295,7 +295,7 @@ static struct { /* node info for each node in my network */
|
||||
|
||||
#define PNCCSNONE 0 /* not configured in ring.cfg */
|
||||
#define PNCCSDISC 1 /* not connected */
|
||||
#define PNCCSCONN 2 /* connected */
|
||||
#define PNCCSCONN 2 /* connecting */
|
||||
#define PNCCSAUTH 3 /* unique ID / password sent */
|
||||
|
||||
/* xmit/recv buffer states and buffers. These must be static because
|
||||
@ -983,10 +983,22 @@ int devpnc (int class, int func, int device) {
|
||||
perror("bind: unable to bind for PNC");
|
||||
fatal(NULL);
|
||||
}
|
||||
if (listen(pncfd, 10)) {
|
||||
if (listen(pncfd, MAXNODEID)) {
|
||||
perror("listen failed for PNC");
|
||||
fatal(NULL);
|
||||
}
|
||||
|
||||
/* a uid is always sent after a connect, so don't bother with the
|
||||
accept until the uid is received. This is Linux-specific and
|
||||
can be disabled, though that may cause problems for rings where
|
||||
the max node id > MAXACCEPTTIME because of connect delays */
|
||||
|
||||
optval = MAXNODEID;
|
||||
if (setsockopt(pncfd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &optval, sizeof(optval))) {
|
||||
perror("setsockopt TCP_DEFER_ACCEPT failed for PNC");
|
||||
fatal(NULL);
|
||||
}
|
||||
|
||||
TRACE(T_RIO, "PNC configured\n");
|
||||
devpoll[device] = PNCPOLL*gvp->instpermsec;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user