plan 9 kernel history: overview | file list | diff list

2001/0530/ip/tcp.c (diff list | history)

2001/0527/sys/src/9/ip/tcp.c:20,262001/0530/sys/src/9/ip/tcp.c:20,26 (short | long | prev | next)
1997/0327    
	TimerON		= 1, 
	TimerDONE	= 2, 
	MAX_TIME 	= (1<<20),	/* Forever */ 
1998/1008    
	TCP_ACK		= 50,		/* Timed ack sequence in ms */ 
2001/0530    
	TCP_ACK		= 200,		/* Timed ack sequence in ms */ 
1997/0327    
 
	URG		= 0x20,		/* Data marked urgent */ 
	ACK		= 0x10,		/* Acknowledge is valid */ 
2001/0527/sys/src/9/ip/tcp.c:270,2752001/0530/sys/src/9/ip/tcp.c:270,276
1999/0320    
void	tcpkeepalive(void*); 
1999/0529    
void	tcpsetkacounter(Tcpctl*); 
2000/0102    
void    tcprxmit(Conv*); 
2001/0530    
void	tcpsettimer(Tcpctl*); 
1997/0327    
 
void 
1998/0306    
tcpsetstate(Conv *s, uchar newstate) 
2001/0527/sys/src/9/ip/tcp.c:1206,12112001/0530/sys/src/9/ip/tcp.c:1207,1213
1997/0327    
				if(tcb->mdev <= 0) 
					tcb->mdev = 1; 
			} 
2001/0530    
			tcpsettimer(tcb); 
1997/0327    
		} 
	} 
 
2001/0527/sys/src/9/ip/tcp.c:1637,16432001/0530/sys/src/9/ip/tcp.c:1639,1644
1997/0327    
void 
tcpoutput(Conv *s) 
{ 
	int x; 
	Tcp seg; 
	int msgs; 
	Tcpctl *tcb; 
2001/0527/sys/src/9/ip/tcp.c:1787,18052001/0530/sys/src/9/ip/tcp.c:1788,1793
1997/0327    
		 * expect acknowledges 
		 */ 
		if(ssize != 0){ 
1998/0918    
			/* round trip depenency */ 
1997/0327    
			x = backoff(tcb->backoff) * 
			    (tcb->mdev + (tcb->srtt>>LOGAGAIN) + MSPTICK) / MSPTICK; 
2000/1012    
                 
1998/0918    
			/* take into account delayed ack */ 
			if(sent <= 2*tcb->mss) 
				x += TCP_ACK/MSPTICK; 
                 
			/* sanity check */ 
1997/0327    
			if(x > (10000/MSPTICK)) 
				x = 10000/MSPTICK; 
			tcb->timer.start = x; 
                 
			if(tcb->timer.state != TimerON) 
1998/0313    
				tcpgo(tpriv, &tcb->timer); 
1997/0327    
 
2001/0527/sys/src/9/ip/tcp.c:1991,19962001/0530/sys/src/9/ip/tcp.c:1979,1985
1997/0327    
			localclose(s, Etimedout); 
			break; 
		} 
2001/0530    
		tcpsettimer(tcb); 
2001/0118    
		netlog(s->p->f, Logtcp, "timeout rexmit 0x%lux\n", tcb->snd.una); 
2000/0102    
		tcprxmit(s); 
2000/0706    
		tpriv->stats[RetransTimeouts]++; 
2001/0527/sys/src/9/ip/tcp.c:2285,22902001/0530/sys/src/9/ip/tcp.c:2274,2298
2000/0424    
		qunlock(c); 
	} 
	return n; 
2001/0530    
} 
 
void 
tcpsettimer(Tcpctl *tcb) 
{ 
	int x; 
 
	/* round trip depenency */ 
	x = backoff(tcb->backoff) * 
	    (tcb->mdev + (tcb->srtt>>LOGAGAIN) + MSPTICK) / MSPTICK; 
 
	/* take into account delayed ack */ 
	if((tcb->snd.ptr - tcb->snd.una) <= 2*tcb->mss) 
		x += TCP_ACK/MSPTICK; 
 
	/* sanity check */ 
	if(x > (10000/MSPTICK)) 
		x = 10000/MSPTICK; 
	tcb->timer.start = x; 
2000/0424    
} 
 
1997/0327    
void 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)