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

1992/0416/port/tcpinput.c (diff list | history)

1992/0414/sys/src/9/port/tcpinput.c:79,1031992/0416/sys/src/9/port/tcpinput.c:79,134 (short | long | prev | next)
1992/0325    
	PUTNEXT(Ipoutput, hbp); 
} 
 
1992/0416    
/* 
 *  flush an incoming call; send a reset to the remote side and close the 
 *  conversation 
 */ 
void 
tcpflushincoming(Ipconv *s) 
{ 
	Tcp seg; 
	Tcpctl *tcb;		 
 
	tcb = &s->tcpctl; 
	seg.source = s->pdst; 
	seg.dest = s->psrc; 
	seg.flags = ACK;	 
	seg.seq = tcb->snd.ptr; 
	seg.ack = tcb->last_ack = tcb->rcv.nxt; 
 
	reset(s->dst, Myip[Myself], 0, 0, &seg); 
	close_self(s, 0); 
} 
 
static void 
tcpmove(struct Tctl *to, struct Tctl *from) 
{ 
	memmove(to, from, sizeof(struct Tctl)); 
} 
 
1992/0406    
Ipconv* 
tcpincoming(Ipconv *ipc, Ipconv *s, Tcp *segp, Ipaddr source) 
{ 
	Ipconv *new; 
 
	if(s->curlog >= s->backlog) 
1992/0416    
	qlock(s); 
	if(s->curlog >= s->backlog){ 
		qunlock(s); 
1992/0406    
		return 0; 
1992/0416    
	} 
1992/0406    
 
	new = ipincoming(ipc, s); 
	if(new == 0) 
1992/0416    
	if(new == 0){ 
		qunlock(s); 
1992/0406    
		return 0; 
1992/0416    
	} 
1992/0406    
 
	qlock(s); 
	s->curlog++; 
	qunlock(s); 
	new->psrc = segp->dest; 
	new->pdst = segp->source; 
	new->dst = source; 
	memmove(&new->tcpctl, &s->tcpctl, sizeof(Tcpctl)); 
1992/0416    
	tcpmove(&new->tcpctl, &s->tcpctl); 
1992/0406    
	new->tcpctl.flags &= ~CLONE; 
	new->tcpctl.timer.arg = new; 
	new->tcpctl.timer.state = TIMER_STOP; 
1992/0414/sys/src/9/port/tcpinput.c:269,2751992/0416/sys/src/9/port/tcpinput.c:300,307
1991/0424    
 
1992/0325    
	/* If we dont understand answer with a rst */ 
1992/0313    
	if(length) 
	if(s->readq == 0) { 
1992/0416    
	if(s->readq == 0) 
	if(tcb->state == Closed) { 
1991/0424    
		freeb(bp); 
		reset(source, dest, tos, length, &seg); 
		goto done; 
1992/0414/sys/src/9/port/tcpinput.c:370,3781992/0416/sys/src/9/port/tcpinput.c:402,412
1991/12171    
			case Finwait2: 
1991/0424    
				/* Place on receive queue */ 
				tcb->rcvcnt += blen(bp); 
1992/0313    
				if(bp) 
				if(s->readq) { 
1991/0424    
					PUTNEXT(s->readq, bp); 
1992/0416    
				if(bp){ 
					if(s->readq) 
						PUTNEXT(s->readq, bp); 
					else 
						putb(&tcb->rcvq, bp); 
1991/0424    
					bp = 0; 
				} 
				tcb->rcv.nxt += length; 
1992/0414/sys/src/9/port/tcpinput.c:811,8251992/0416/sys/src/9/port/tcpinput.c:845,867
1991/0424    
	tcb->acktimer.arg = (void *)s; 
} 
 
1992/0416    
/* 
 *  called with tcb locked 
 */ 
1991/0424    
void 
1992/0111    
close_self(Ipconv *s, char reason[]) 
1991/0424    
{ 
	Reseq *rp,*rp1; 
	Tcpctl *tcb = &s->tcpctl; 
1992/0416    
	Block *bp; 
1991/0424    
 
	stop_timer(&tcb->timer); 
	stop_timer(&tcb->rtt_timer); 
	s->err = reason; 
1992/0416    
 
	/* flush receive queue */ 
	while(bp = getb(&tcb->rcvq)) 
		freeb(bp); 
1991/0424    
 
	/* Flush reassembly queue; nothing more can arrive */ 
	for(rp = tcb->reseq;rp != 0;rp = rp1){ 


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