bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] already connected when closed


From: Alfred M. Szmidt
Subject: Re: [bug-inetutils] already connected when closed
Date: Sat, 30 Jun 2007 15:41:27 +0200 (CEST)

       -    {
       -      printf ("Already connected to %s, use close first.\n", hostname);
       -      code = -1;
       -      return;
       -    }
       +    disconnect (0, 0);

   It solves the stated issue, but introduces another: now if I do

   ftp> open alpha.gnu.org
   ... gets connected, then, without any delay:
   ftp> open ftp.gnu.org

   It disconnects me from alpha even though the connection is still
   live.  In the case where the connection is really open, I'd
   actually like to have the warning.  It's only where the connection
   has timed out that the warning is superfluous.

UI-wise, isn't it more intutive that it just disconnects like this?  I
don't have a strong opinion on the topic, so which ever way you prefer
is what I'll go with.  I thought it would be better to just
disconnect.

   Do you have a way to easily probe the connection?  Send a no-op or
   something?

Yes, that should be possible by sending the NOOP command.  Maybe
something like this (completely untested):

--- cmds.c      28 Jun 2007 15:59:42 +0200      1.33
+++ cmds.c      30 Jun 2007 15:35:09 +0200      
@@ -169,7 +169,8 @@ setpeer (argc, argv)
   char *host;
   int port;
 
-  if (connected)
+  if (connected && 
+      command ("NOOP") != COMPLETE)
     disconnect (0, 0);
   if (argc < 2)
     another (&argc, &argv, "to");





reply via email to

[Prev in Thread] Current Thread [Next in Thread]