X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/99c850b2087a6e4802398aae0ba711be6e43d15d..6f444bda1b7deb31cf7fb2395cb0993c3e3b8c42:/man/conn.3 diff --git a/man/conn.3 b/man/conn.3 index 3ecc43f..74a4604 100644 --- a/man/conn.3 +++ b/man/conn.3 @@ -1,5 +1,6 @@ .\" -*-nroff-*- .TH conn 3 "23 May 1999" "Straylight/Edgeware" "mLib utilities library" +.\" @conn_fd .\" @conn_init .\" @conn_kill .SH NAME @@ -8,6 +9,10 @@ conn \- selector for nonblocking connections .nf .B "#include " +.BI "int conn_fd(conn *" c ", sel_state *" s ", int " fd , +.BI " void (*" func ")(int " fd ", void *" p ), +.BI " void *" p ); + .BI "int conn_init(conn *" c ", sel_state *" s ", int " fd , .BI " struct sockaddr *" dst ", int " dsz , .BI " void (*" func ")(int " fd ", void *" p ), @@ -69,10 +74,10 @@ the connection finishes. .PP A few words are in order about .BR conn_init 's -detailed behaviour and return value. If the it returns \-1, the -connection attempt has failed immediately (an error code is stored in -the global variable -.BR errno ), +detailed behaviour and return value. If it returns \-1, the connection +attempt has failed immediately, an error code is stored in the global +variable +.BR errno , the file descriptor has been .IR closed , and the connection function will @@ -89,6 +94,23 @@ success) or the value \-1 for failure; in the latter case, an appropriate error code is stored in .BR errno . .PP +Alternatively, if you have a socket with a pending connection (i.e., a +call to +.BR connect +returned \-1 and set +.B errno +to +.BR EINPROGRESS ), +you can call +.BR conn_fd. +Its arguments are the same as for +.BR conn_init , +except that since the socket knows its a peer address the +.I dst +and +.I dsz +arguments are not given, and it can't fail. +.PP If you want to cancel the connection attempt before it finishes, call .B conn_kill with the address of the selector. The file descriptor is closed, and