Double receive buffer size on sockets.

PR:		bin/72366
Ok'd by:	dwmalone
Approved by:	julian (mentor)
Obtained from:	OpenBSD
MFC after:	1 month
This commit is contained in:
Gleb Smirnoff 2004-11-11 09:39:04 +00:00
parent 337c1d7b9b
commit 43af2cc4a5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137568

View File

@ -336,6 +336,7 @@ static void unmapped(struct sockaddr *);
static void wallmsg(struct filed *, struct iovec *);
static int waitdaemon(int, int, int);
static void timedout(int);
static void double_rbuf(int);
int
main(int argc, char *argv[])
@ -510,8 +511,11 @@ main(int argc, char *argv[])
dprintf("cannot create %s (%d)\n", fx->name, errno);
if (fx == &funix_default || fx == &funix_secure)
die(0);
else
else {
STAILQ_REMOVE(&funixes, fx, funix, next);
continue;
}
double_rbuf(fx->s);
}
}
if (SecureMode <= 1)
@ -2560,6 +2564,8 @@ socksetup(int af, const char *bindhostname)
continue;
}
double_rbuf(*s);
(*socks)++;
s++;
}
@ -2576,3 +2582,14 @@ socksetup(int af, const char *bindhostname)
return (socks);
}
static void
double_rbuf(int fd)
{
socklen_t slen, len;
if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, &slen) == 0) {
len *= 2;
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, slen);
}
}