Skip to content
Snippets Groups Projects
Commit 8e8d7f29 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

lookup_async() now uses Stdio.File->async_connect().

Rev: lib/modules/Protocols.pmod/Ident.pmod:1.7
parent f314ad29
No related branches found
No related tags found
No related merge requests found
// An implementation of the IDENT protocol, specified in RFC 931. // An implementation of the IDENT protocol, specified in RFC 931.
// //
// $Id: Ident.pmod,v 1.6 1998/05/28 19:50:03 grubba Exp $ // $Id: Ident.pmod,v 1.7 1999/01/30 01:35:41 grubba Exp $
// #define IDENT_DEBUG // #define IDENT_DEBUG
...@@ -100,6 +100,14 @@ class lookup_async ...@@ -100,6 +100,14 @@ class lookup_async
do_callback(({ "ERROR", "TIMEOUT" })); do_callback(({ "ERROR", "TIMEOUT" }));
} }
void connected()
{
#ifdef IDENT_DEBUG
werror(sprintf("Protocols.Ident: Connection OK, query:%O\n", query));
#endif /* IDENT_DEBUG */
con->set_nonblocking(read_cb, write_cb, close_cb);
}
void create(object fd, function(array(string), mixed ...:void) cb, void create(object fd, function(array(string), mixed ...:void) cb,
mixed ... args) mixed ... args)
{ {
...@@ -121,21 +129,19 @@ class lookup_async ...@@ -121,21 +129,19 @@ class lookup_async
destruct(con); destruct(con);
error("Protocols.Ident: open_socket() failed."); error("Protocols.Ident: open_socket() failed.");
} }
mixed err;
if (err = catch(con->connect(raddr[0], 113))) {
destruct(con);
throw(err);
}
#ifdef IDENT_DEBUG
werror(sprintf("Protocols.Ident: Connection OK, query:%O\n", query));
#endif /* IDENT_DEBUG */
callback = cb; callback = cb;
cb_args = args; cb_args = args;
con->set_nonblocking(read_cb, write_cb, close_cb);
call_out(timeout, 60); call_out(timeout, 60);
mixed err;
if (err = catch(con->async_connect(raddr[0], 113, connected, close_cb))) {
callback = 0;
cb_args = 0;
destruct(con);
throw(err);
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment