changeset 17309:a2edef5eb1b1

- Document some weird-looking logic in the GnuTLS plugin.
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 25 May 2007 05:22:25 +0000
parents 2d2c72f70e8c
children c76bee45540a
files libpurple/plugins/ssl/ssl-gnutls.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Fri May 25 04:34:43 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Fri May 25 05:22:25 2007 +0000
@@ -123,6 +123,18 @@
 	gnutls_data->handshake_handler = purple_input_add(gsc->fd,
 		PURPLE_INPUT_READ, ssl_gnutls_handshake_cb, gsc);
 
+	/* Orborde asks: Why are we configuring a callback, then
+	   immediately calling it?
+
+	   Answer: gnutls_handshake (up in handshake_cb) needs to be called
+	   once in order to get the ball rolling on the SSL connection.
+	   Once it has done so, only then will the server reply, triggering
+	   the callback.
+
+	   Since the logic driving gnutls_handshake is the same with the first
+	   and subsequent calls, we'll just fire the callback immediately to
+	   accomplish this.
+	*/
 	ssl_gnutls_handshake_cb(gsc, gsc->fd, PURPLE_INPUT_READ);
 }