From 8e8d7f2980eb3ac18b83334be4d26267565f92dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sat, 30 Jan 1999 02:35:41 +0100
Subject: [PATCH] lookup_async() now uses Stdio.File->async_connect().

Rev: lib/modules/Protocols.pmod/Ident.pmod:1.7
---
 lib/modules/Protocols.pmod/Ident.pmod | 28 ++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/lib/modules/Protocols.pmod/Ident.pmod b/lib/modules/Protocols.pmod/Ident.pmod
index 6ffedc9237..b11b4a28e2 100644
--- a/lib/modules/Protocols.pmod/Ident.pmod
+++ b/lib/modules/Protocols.pmod/Ident.pmod
@@ -1,6 +1,6 @@
 // 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
@@ -100,6 +100,14 @@ class lookup_async
     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,
 	      mixed ... args)
   {
@@ -121,21 +129,19 @@ class lookup_async
       destruct(con);
       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;
     cb_args = args;
-    con->set_nonblocking(read_cb, write_cb, close_cb);
 
     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);
+    }
   }
 }
 
-- 
GitLab