[gnutls-dev] Re: Session resuming in gnutls-cli

Gergely Nagy algernon@boszorka.mad.hu
Tue Apr 15 14:00:01 2003


This patch fixes the problem for me:

--- gnutls5-orig/src/cli.c	2003-02-04 13:52:25.000000000 +0100
+++ gnutls5-work/src/cli.c	2003-04-14 21:06:41.000000000 +0200
@@ -278,6 +278,8 @@
 
 	 err = connect(sd, (SA *) & sa, sizeof(sa));
 	 ERR(err, "connect");
+
+	 hd.fd = sd;
       } else {
 	 break;
       }


The problem was - as I see - that even though a new connection was
made, the FD wasn't set up properly. hd.fd is only touched outside of
the for loop, but socket_bye() sets it to -1. So in the next
iteration, it will still be -1.

As is my wrong habit, the patch was made to fix the problem, without
deeper understanding of the underlying mechanisms. It may or may not
be a correct fix, but it appears to be one :)