From 9066bb6b9d19ff53917be5127d7bb7c79b0c77ed Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 19 Dec 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-12-19 --- ip/tcp.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ip/tcp.c b/ip/tcp.c index d606da60ec92a27021d8e17a2e4253d55cb0c73f..ab0fa509664819f03f584eb7b2187dace03cc397 100644 --- a/ip/tcp.c +++ b/ip/tcp.c @@ -361,6 +361,9 @@ tcpannounce(Conv *c, char **argv, int argc) return nil; } +/* + * tcpclose is always called with the q locked + */ static void tcpclose(Conv *c) { @@ -700,6 +703,13 @@ tcpstart(Conv *s, int mode, ushort window) tcb = (Tcpctl*)s->ptcl; + qlock(s); + /* Send SYN, go into SYN_SENT state */ + if(waserror()){ + qunlock(s); + nexterror(); + } + inittcpctl(s); tcb->window = window; tcb->rcv.wnd = window; @@ -713,20 +723,14 @@ tcpstart(Conv *s, int mode, ushort window) case TCP_CONNECT: tpriv->stats[ActiveOpens]++; - /* Send SYN, go into SYN_SENT state */ - qlock(s); - if(waserror()){ - qunlock(s); - nexterror(); - } tcb->flags |= ACTIVE; tcpsndsyn(tcb); tcpsetstate(s, Syn_sent); tcpoutput(s); - qunlock(s); - poperror(); break; } + qunlock(s); + poperror(); } static char*