X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/5feb52afba684ae49cc96f66fd62fc190c251b92..ee9b1404a97247490a09fcf10af83a76a3d3d72d:/conn.c diff --git a/conn.c b/conn.c index 476cff9..743adeb 100644 --- a/conn.c +++ b/conn.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: conn.c,v 1.3 1999/05/23 12:12:37 mdw Exp $ + * $Id: conn.c,v 1.4 1999/07/26 23:21:02 mdw Exp $ * * Nonblocking connect handling * @@ -30,6 +30,10 @@ /*----- Revision history --------------------------------------------------* * * $Log: conn.c,v $ + * Revision 1.4 1999/07/26 23:21:02 mdw + * Bug fix: remove the selector before doing the callback, in case client + * adds a writer for the connected socket. + * * Revision 1.3 1999/05/23 12:12:37 mdw * Interface change to make the `conn' selector useful for generic stream * sockets rather than just IPv4 ones. @@ -83,16 +87,16 @@ static void conn_connect(int fd, unsigned mode, void *p) int sinsz; sinsz = sizeof(buf); + sel_rmfile(&c->writer); if (getpeername(fd, (struct sockaddr *)buf, &sinsz) < 0) { int err; int errsz = sizeof(err); if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errsz) == 0) errno = err; - c->func(-1, c->p); close(fd); + c->func(-1, c->p); } else c->func(fd, c->p); - sel_rmfile(&c->writer); } /* --- @conn_init@ --- *