From 6585faa0fc82250b0b9e0cf4e26bfaa36086d27b Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 11 Feb 2003 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2003-02-11 --- ip/tcp.c | 33 ++++++++++++++++++--------------- port/devssl.c | 14 -------------- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/ip/tcp.c b/ip/tcp.c index 449341eb2967ed612792b8dc473159846b2c03e6..fab8dcf1d86d82e34cb1da86141cef7cd2d05e83 100644 --- a/ip/tcp.c +++ b/ip/tcp.c @@ -215,7 +215,6 @@ struct Tcpctl ulong nxt; /* Receive pointer to next uchar slot */ ulong wnd; /* Receive window incoming */ ulong urg; /* Urgent pointer */ - ulong lastacked; /* Last ack sent */ int blocked; int una; /* unacked data segs */ int scale; /* how much to left shift window in rcved packets */ @@ -362,7 +361,7 @@ struct Tcppriv * it that number gets acked by the other end, we shut down the connection. * Look for tcpporthogedefense in the code. */ -int tcpporthogdefense = 0; +int tcpporthogdefense = 1; int addreseq(Tcpctl*, Tcppriv*, Tcp*, Block*, ushort); void getreseq(Tcpctl*, Tcp*, Block**, ushort*); @@ -1322,7 +1321,7 @@ tcphangup(Conv *s) if(s->raddr != 0) { seg.flags = RST | ACK; seg.ack = tcb->rcv.nxt; - tcb->rcv.lastacked = tcb->rcv.nxt; + tcb->rcv.una = 0; seg.seq = tcb->snd.ptr; seg.wnd = 0; seg.urg = 0; @@ -2275,6 +2274,20 @@ reset: panic("tcp packblock"); qpassnolim(s->rq, bp); bp = nil; + + /* + * Force an ack every 2 data messages. This is + * a hack for rob to make his home system run + * faster. + * + * this also keeps the standard TCP congestion + * control working since it needs an ack every + * 2 max segs worth. This is not quite that, + * but under a real stream is equivalent since + * every packet has a max seg in it. + */ + if(++(tcb->rcv.una) >= 2) + tcb->flags |= FORCE; } tcb->rcv.nxt += length; @@ -2283,13 +2296,6 @@ reset: */ tcprcvwin(s); - /* - * force an ack if we've got 2 segs since we - * last acked. - */ - if(tcb->rcv.nxt - tcb->rcv.lastacked >= 2*tcb->mss) - tcb->flags |= FORCE; - /* * turn on the acktimer if there's something * to ack @@ -2457,19 +2463,17 @@ tcpoutput(Conv *s) if((tcb->flags&FORCE) == 0) break; - tcphalt(tpriv, &tcb->acktimer); - tcb->flags &= ~FORCE; tcprcvwin(s); /* By default we will generate an ack */ + tcphalt(tpriv, &tcb->acktimer); tcb->rcv.una = 0; seg.source = s->lport; seg.dest = s->rport; seg.flags = ACK; seg.mss = 0; seg.ws = 0; - switch(tcb->state){ case Syn_sent: seg.flags = 0; @@ -2497,7 +2501,6 @@ tcpoutput(Conv *s) } seg.seq = tcb->snd.ptr; seg.ack = tcb->rcv.nxt; - tcb->rcv.lastacked = tcb->rcv.nxt; seg.wnd = tcb->rcv.wnd; /* Pull out data to send */ @@ -2619,7 +2622,7 @@ tcpsendka(Conv *s) else seg.seq = tcb->snd.una-1; seg.ack = tcb->rcv.nxt; - tcb->rcv.lastacked = tcb->rcv.nxt; + tcb->rcv.una = 0; seg.wnd = tcb->rcv.wnd; if(tcb->state == Finwait2){ seg.flags |= FIN; diff --git a/port/devssl.c b/port/devssl.c index fbb4e0df1e844875efd8f28675fa4553a232672f..e407fda2fdd671cd0a7238da516752a06d89fdc4 100644 --- a/port/devssl.c +++ b/port/devssl.c @@ -591,19 +591,6 @@ sslbread(Chan *c, long n, ulong) } ensure(s, &s->unprocessed, toconsume+len); - /* - * Now we have a full SSL packet in the unprocessed list. - * Start processing. We can't get Eintr's here. - * The only cause for errors from here until the end of the - * loop is allocation failures in the block manipulation. - * We'll worry about that when we come across it. - */ - - if(waserror()){ - print("devssl: unhandled allocation failure\n"); - nexterror(); - } - /* skip header */ consume(&s->unprocessed, consumed, toconsume); @@ -653,7 +640,6 @@ sslbread(Chan *c, long n, ulong) s->in.mid++; qunlock(&s->in.ctlq); poperror(); - poperror(); } /* return at most what was asked for */