[ekg2-commit] r4230 - in trunk: ekg plugins/jabber: trunk/ekg/net.c trunk/plugins/jabber/jabber.c

SVN commit svn w toxygen.net
Pią, 8 Sie 2008, 11:10:41 CEST


Author: darkjames
Date: 2008-08-08 11:10:41 +0200 (Fri, 08 Aug 2008)
New Revision: 4230

Modified:
   trunk/ekg/net.c
   trunk/plugins/jabber/jabber.c
Log:
fix use_ssl, problem was with:

if (session_int_get(s, "use_ssl")) {
	jabber_handle_connect_ssl(-1, fd, 0, s);
	return -1;
}

which should be called only once.



Modified: trunk/ekg/net.c
===================================================================
--- trunk/ekg/net.c	2008-08-08 08:41:36 UTC (rev 4229)
+++ trunk/ekg/net.c	2008-08-08 09:10:41 UTC (rev 4230)
@@ -539,7 +539,7 @@
 
 	/* 3) fail */
 	if (s)
-		c->async(2, -1, WATCH_WRITE, s);
+		c->async(-1, -1, WATCH_WRITE, s);
 	ekg_connect_data_free(c);
 	return 0;
 }

Modified: trunk/plugins/jabber/jabber.c
===================================================================
--- trunk/plugins/jabber/jabber.c	2008-08-08 08:41:36 UTC (rev 4229)
+++ trunk/plugins/jabber/jabber.c	2008-08-08 09:10:41 UTC (rev 4230)
@@ -719,35 +719,20 @@
 
 static WATCHER(jabber_handle_connect_tlen_hub);
 
-WATCHER(jabber_handle_connect2)
+WATCHER(jabber_handle_connect)
 {
 	session_t *s = (session_t *) data;
 	jabber_private_t *j = jabber_private(s);
 	int tlenishub;
+
+	if (type)
+		return -1;
 	
-	if (type == -1) {	/* special ekg_connect() state */
-		jabber_handle_disconnect(s, _("No server could be reached"), EKG_DISCONNECT_FAILURE);
-		/* fd == -1 */
-		return 0;
-	}
-
-	if (type == 2) {
-		jabber_handle_disconnect(s, _("No server could be reached"), EKG_DISCONNECT_FAILURE);
-		/* XXX, session timeouted */
-		return 0;
-	}
-
         debug_function("[jabber] socket() = %d\n", fd);
 
 	tlenishub = (j->istlen > 1);
         j->fd = fd;
 
-#ifdef JABBER_HAVE_SSL
-	if (session_int_get(s, "use_ssl")) {
-		jabber_handle_connect_ssl(-1, fd, 0, s);
-		return -1;
-        }
-#endif
 	if (tlenishub) {
 		char *req, *esc; 
 
@@ -798,6 +783,31 @@
 	return -1;
 }
 
+WATCHER(jabber_handle_connect2) {
+	session_t *s = (session_t *) data;
+
+	if (type == -1) {	/* special ekg_connect() state */
+		jabber_handle_disconnect(s, _("No server could be reached"), EKG_DISCONNECT_FAILURE);
+		/* fd == -1 */
+		return 0;
+	}
+
+	if (type == 2) {
+		jabber_handle_disconnect(s, _("No server could be reached"), EKG_DISCONNECT_FAILURE);
+		/* XXX, session timeouted */
+		return 0;
+	}
+
+#ifdef JABBER_HAVE_SSL
+	if (session_int_get(s, "use_ssl")) {
+		jabber_handle_connect_ssl(-1, fd, 0, s);
+		return -1;
+        }
+#endif
+	
+	return jabber_handle_connect(type, fd, watch, data);
+}
+
 static WATCHER(jabber_handle_connect_tlen_hub) {	/* tymczasowy */
 	session_t *s = (session_t *) data;
 	jabber_private_t *j = jabber_private(s);
@@ -1075,7 +1085,7 @@
 	} else {
 		// handshake successful
 		j->using_ssl = 1;
-		watch_add(&jabber_plugin, fd, WATCH_WRITE, jabber_handle_connect2, s);
+		watch_add(&jabber_plugin, fd, WATCH_WRITE, jabber_handle_connect, s);
 	}
 
 	return -1;



Więcej informacji o liście dyskusyjnej ekg2-commit