[ekg2-commit] r4209 - trunk/ekg: trunk/ekg/commands.c trunk/ekg/net.c trunk/ekg/net.h

SVN commit svn w toxygen.net
Czw, 7 Sie 2008, 12:26:18 CEST


Author: darkjames
Date: 2008-08-07 12:26:17 +0200 (Thu, 07 Aug 2008)
New Revision: 4209

Modified:
   trunk/ekg/commands.c
   trunk/ekg/net.c
   trunk/ekg/net.h
Log:
- add some missing includes
- fix ekg_connect() in net.h
- i dislike stdbool.h sorry. replace them with int.


Modified: trunk/ekg/commands.c
===================================================================
--- trunk/ekg/commands.c	2008-08-07 09:57:54 UTC (rev 4208)
+++ trunk/ekg/commands.c	2008-08-07 10:26:17 UTC (rev 4209)
@@ -101,7 +101,7 @@
 #include "scripts.h"
 #include "windows.h"
 #include "xmalloc.h"
-
+#include "net.h"
 #include "queries.h"
 #include "dynstuff_inline.h"
 

Modified: trunk/ekg/net.c
===================================================================
--- trunk/ekg/net.c	2008-08-07 09:57:54 UTC (rev 4208)
+++ trunk/ekg/net.c	2008-08-07 10:26:17 UTC (rev 4209)
@@ -35,7 +35,6 @@
 #include <string.h>
 #include <stdarg.h>	/* ? */
 #include <unistd.h>
-#include <stdbool.h>
 
 #define __USE_POSIX
 #define __USE_GNU	/* glibc-2.8, needed for (struct hostent->h_addr) */
@@ -64,13 +63,12 @@
  */
 
 #include "debug.h"
+#include "dynstuff.h"
+#include "net.h"
 #include "plugins.h"
+#include "sessions.h"
 #include "xmalloc.h"
 
-#ifndef INADDR_NONE		/* XXX, xmalloc.h (?) */
-#  define INADDR_NONE (unsigned long) 0xffffffff
-#endif
-
 #ifdef LIBIDN /* stolen from squid->url.c (C) Duane Wessels */
 static const char valid_hostname_chars_u[] =
 	"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -334,7 +332,7 @@
 	return out;
 }
 
-static bool ekg_connect_loop(struct ekg_connect_data *c) {
+static int ekg_connect_loop(struct ekg_connect_data *c) {
 	char *host;
 
 	/* 1) if anything is in connect_queue, try to connect */
@@ -343,7 +341,7 @@
 		/* XXX */
 		xfree(host);
 
-		return true;
+		return 1;
 	}
 
 	/* 2) if anything is in resolver_queue, try to resolve */
@@ -352,20 +350,20 @@
 		/* XXX */
 		xfree(host);
 
-		return true;
+		return 1;
 	}
 
 	/* 3) fail */
 	c->async(0, 0, 0, c->session); /* XXX: pass error? */
 	xfree(c); /* arrays should be already freed */
-	return false;
+	return 0;
 }
 
-bool ekg_connect(session_t *session, const char *server, int (*prefer_comparison)(void *, void *), watcher_handler_func_t async) {
+int ekg_connect(session_t *session, const char *server, int (*prefer_comparison)(void *, void *), watcher_handler_func_t async) {
 	struct ekg_connect_data	*c = xmalloc(sizeof(struct ekg_connect_data));
 
 	if (!session || !server || !async)
-		return false;
+		return 0;
 
 	/* 1) fill struct */
 	c->resolver_queue	= array_make(server, ",", 0, 1, 1);

Modified: trunk/ekg/net.h
===================================================================
--- trunk/ekg/net.h	2008-08-07 09:57:54 UTC (rev 4208)
+++ trunk/ekg/net.h	2008-08-07 10:26:17 UTC (rev 4209)
@@ -22,6 +22,7 @@
 #ifndef EKG2_WIN32_NOFUNCTION
 
 #include "plugins.h"
+#include "sessions.h"
 
 #ifndef INADDR_NONE
 #  define INADDR_NONE (unsigned long) 0xffffffff
@@ -30,8 +31,7 @@
 watch_t *ekg_resolver2(plugin_t *plugin, const char *server, watcher_handler_func_t async, void *data);
 watch_t *ekg_resolver3(plugin_t *plugin, const char *server, watcher_handler_func_t async, void *data);
 
-watch_t *ekg_connect(session_t *session, const char *server, int (*prefer_comparison)(void *, void *),
-		watcher_handler_func_t async, void *data);
+int ekg_connect(session_t *session, const char *server, int (*prefer_comparison)(void *, void *), watcher_handler_func_t async);
 
 #endif /* EKG2_WIN32_NOFUNCTION */
 #endif /* __EKG_NET_H */



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