X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/bf61b5660299e88399304cd8eb9bacddc73a765b..b89053c0750e42d88ff92e3efc3d546f18a6d435:/mac/otnet.c diff --git a/mac/otnet.c b/mac/otnet.c index 4c9ec4b4..baa7a8a5 100644 --- a/mac/otnet.c +++ b/mac/otnet.c @@ -313,6 +313,8 @@ Socket ot_new(SockAddr addr, int port, int privport, int oobinline, /* Add this to the list of all sockets */ ret->next = ot.socklist; ret->prev = &ot.socklist; + if (ret->next != NULL) + ret->next->prev = &ret->next; ot.socklist = ret; return (Socket) ret; @@ -462,9 +464,13 @@ void ot_recv(Actual_Socket s) if (s->frozen) return; - while ((o = OTRcv(s->ep, buf, sizeof(buf), &flags)) != kOTNoDataErr) { - plug_receive(s->plug, 0, buf, sizeof(buf)); - } + do { + o = OTRcv(s->ep, buf, sizeof(buf), &flags); + if (o > 0) + plug_receive(s->plug, 0, buf, sizeof(buf)); + if (o < 0 && o != kOTNoDataErr) + plug_closing(s->plug, NULL, 0, 0); /* XXX Error msg */ + } while (o > 0); }