If rcmd() fails, return immediately instead of trying a bunch of
setsockopt()'s on a -1 file descriptor. Remove attempt to decrease TCP MSS; it makes no sense. Set the IP TOS to IPTOS_THROUGHPUT as an indication that this is an application sending large blocks of data, as recommended by RFC1700.
This commit is contained in:
parent
d4788da623
commit
d71ba03df8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19239
@ -49,7 +49,8 @@ static char sccsid[] = "@(#)dumprmt.c 8.1 (Berkeley) 6/5/93";
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/in_systm.h>
|
||||||
|
#include <netinet/ip.h>
|
||||||
|
|
||||||
#include <protocols/dumprestore.h>
|
#include <protocols/dumprestore.h>
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ rmtgetconn()
|
|||||||
#endif
|
#endif
|
||||||
char *tuser;
|
char *tuser;
|
||||||
int size;
|
int size;
|
||||||
int maxseg;
|
int throughput;
|
||||||
|
|
||||||
if (sp == NULL) {
|
if (sp == NULL) {
|
||||||
sp = getservbyname("shell", "tcp");
|
sp = getservbyname("shell", "tcp");
|
||||||
@ -148,6 +149,8 @@ rmtgetconn()
|
|||||||
rmt = _PATH_RMT;
|
rmt = _PATH_RMT;
|
||||||
rmtape = rcmd(&rmtpeer, (u_short)sp->s_port, pwd->pw_name, tuser,
|
rmtape = rcmd(&rmtpeer, (u_short)sp->s_port, pwd->pw_name, tuser,
|
||||||
rmt, (int *)0);
|
rmt, (int *)0);
|
||||||
|
if (rmtape < 0)
|
||||||
|
return;
|
||||||
size = ntrec * TP_BSIZE;
|
size = ntrec * TP_BSIZE;
|
||||||
if (size > 60 * 1024) /* XXX */
|
if (size > 60 * 1024) /* XXX */
|
||||||
size = 60 * 1024;
|
size = 60 * 1024;
|
||||||
@ -157,10 +160,10 @@ rmtgetconn()
|
|||||||
setsockopt(rmtape, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size)) < 0)
|
setsockopt(rmtape, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size)) < 0)
|
||||||
size -= TP_BSIZE;
|
size -= TP_BSIZE;
|
||||||
(void)setsockopt(rmtape, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size));
|
(void)setsockopt(rmtape, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size));
|
||||||
maxseg = 1024;
|
throughput = IPTOS_THROUGHPUT;
|
||||||
if (setsockopt(rmtape, IPPROTO_TCP, TCP_MAXSEG,
|
if (setsockopt(rmtape, IPPROTO_IP, IP_TOS,
|
||||||
&maxseg, sizeof (maxseg)) < 0)
|
&throughput, sizeof(throughput)) < 0)
|
||||||
perror("TCP_MAXSEG setsockopt");
|
perror("IP_TOS:IPTOS_THROUGHPUT setsockopt");
|
||||||
|
|
||||||
#ifdef notdef
|
#ifdef notdef
|
||||||
if (setsockopt(rmtape, IPPROTO_TCP, TCP_NODELAY, &on, sizeof (on)) < 0)
|
if (setsockopt(rmtape, IPPROTO_TCP, TCP_NODELAY, &on, sizeof (on)) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user