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

1992/0903/port/tcpif.c (diff list | history)

1992/0711/sys/src/9/port/tcpif.c:11,341992/0903/sys/src/9/port/tcpif.c:11,31 (short | long | prev | next)
1991/0424    
#define DPRINT	if(tcpdbg) print 
 
void 
state_upcall(Ipconv *s, char oldstate, char newstate) 
1992/0903    
tcpxstate(Ipconv *s, char oldstate, char newstate) 
1991/0424    
{ 
	Block *bp; 
	int len; 
1992/0903    
	Block *bp; 
1992/0303    
	Tcpctl *tcb = &s->tcpctl; 
1991/0424    
 
1992/0111    
	DPRINT("state_upcall: %s -> %s err %s\n",  
1991/0424    
	      tcpstate[oldstate], tcpstate[newstate], s->err); 
                 
	if(oldstate == newstate) 
		return; 
 
	switch(newstate) { 
1991/12171    
	case Closed: 
1991/0424    
		s->psrc = 0; 
1992/0903    
		s->psrc = 0;		/* This connection is toast */ 
1991/0424    
		s->pdst = 0; 
		s->dst = 0; 
1991/1126    
		/* NO break */ 
1992/0903    
 
1991/12171    
	case Close_wait:		/* Remote closes */ 
1991/0424    
		if(s->err) { 
1992/0111    
			len = strlen(s->err); 
1992/0711/sys/src/9/port/tcpif.c:46,521992/0903/sys/src/9/port/tcpif.c:43,49
1992/0322    
			qunlock(s); 
			nexterror(); 
		} 
1992/0416    
		if(s->readq == 0){ 
1992/0903    
		if(s->readq == 0) { 
1992/0416    
			if(newstate == Close_wait) 
				putb(&tcb->rcvq, bp); 
			else 
1992/0711/sys/src/9/port/tcpif.c:84,901992/0903/sys/src/9/port/tcpif.c:81,87
1991/0424    
	switch(mode){ 
	case TCP_PASSIVE: 
		tcb->flags |= CLONE; 
1991/12171    
		setstate(s, Listen); 
1992/0903    
		tcpsetstate(s, Listen); 
1991/0424    
		break; 
1992/0325    
 
1991/0424    
	case TCP_ACTIVE: 
1992/0711/sys/src/9/port/tcpif.c:95,1031992/0903/sys/src/9/port/tcpif.c:92,100
1992/0322    
			qunlock(tcb); 
			nexterror(); 
		} 
1991/0424    
		send_syn(tcb); 
1991/12171    
		setstate(s, Syn_sent); 
1991/0424    
		tcp_output(s); 
1992/0903    
		tcpsndsyn(tcb); 
		tcpsetstate(s, Syn_sent); 
		tcpoutput(s); 
1992/0322    
		poperror(); 
1991/0424    
		qunlock(tcb); 
1992/0303    
		sleep(&tcb->syner, notsyner, tcb); 


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