From c2e0619309a66d11b2d51e3b94c2a5da691a057a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 1 Apr 1999 17:45:02 +0200 Subject: [PATCH] async_connect() now calls the callback if the connect() failed. Rev: lib/modules/Stdio.pmod/module.pmod:1.41 --- lib/modules/Stdio.pmod/module.pmod | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/modules/Stdio.pmod/module.pmod b/lib/modules/Stdio.pmod/module.pmod index f5a82971fa..c3926cf3ca 100644 --- a/lib/modules/Stdio.pmod/module.pmod +++ b/lib/modules/Stdio.pmod/module.pmod @@ -1,4 +1,4 @@ -// $Id: module.pmod,v 1.40 1999/03/26 19:59:44 hubbe Exp $ +// $Id: module.pmod,v 1.41 1999/04/01 15:45:02 grubba Exp $ import String; @@ -109,12 +109,15 @@ class File _async_args = args; set_nonblocking(0, _async_connected, _async_failed); mixed err; - if (err = catch(connect(host, port))) { + int res; + if (err = catch(res = connect(host, port))) { // Illegal format. -- Bad hostname? - set_nonblocking(0,0,0); - throw(err); + call_out(_async_failed(), 0); + } else if (!res) { + // Connect failed. + call_out(_async_failed(), 0); } - return(1); // OK so far. + return(1); // OK so far. (Or rather the callback will be used). } object(File) pipe(void|int how) -- GitLab