dbus/dbus dbus-server-unix.c, 1.20, 1.21 dbus-server.c, 1.33,
1.34 dbus-sysdeps.c, 1.70, 1.71 dbus-test.c, 1.32,
1.33 dbus-test.h, 1.24, 1.25
Kristian Hogsberg
krh at pdx.freedesktop.org
Thu Apr 22 08:13:09 EST 2004
Update of /cvs/dbus/dbus/dbus
In directory pdx:/tmp/cvs-serv6906/dbus
Modified Files:
dbus-server-unix.c dbus-server.c dbus-sysdeps.c dbus-test.c
dbus-test.h
Log Message:
2004-04-21 Kristian Høgsberg <krh at redhat.com>
* dbus/dbus-server-unix.c (unix_finalize): Don't unref
unix_server->watch here, it is unreffed in disconnect.
(_dbus_server_new_for_tcp_socket): convert NULL host to
"localhost" here so we don't append NULL to address.
* dbus/dbus-server.c (_dbus_server_test): Add test case for
various addresses, including tcp with no explicit host.
Index: dbus-server-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-server-unix.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- a/dbus-server-unix.c 2 Dec 2003 10:44:21 -0000 1.20
+++ b/dbus-server-unix.c 21 Apr 2004 22:13:07 -0000 1.21
@@ -59,9 +59,6 @@
{
DBusServerUnix *unix_server = (DBusServerUnix*) server;
- if (unix_server->watch)
- _dbus_watch_unref (unix_server->watch);
-
dbus_free (unix_server->socket_name);
_dbus_server_finalize_base (server);
@@ -368,6 +365,9 @@
return NULL;
}
+ if (host == NULL)
+ host = "localhost";
+
if (!_dbus_string_append (&address, "tcp:host=") ||
!_dbus_string_append (&address, host) ||
!_dbus_string_append (&address, ",port=") ||
Index: dbus-server.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-server.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- a/dbus-server.c 21 Mar 2004 13:42:23 -0000 1.33
+++ b/dbus-server.c 21 Apr 2004 22:13:07 -0000 1.34
@@ -788,3 +788,42 @@
/** @} */
+#ifdef DBUS_BUILD_TESTS
+#include "dbus-test.h"
+
+dbus_bool_t
+_dbus_server_test (void)
+{
+ const char *valid_addresses[] = {
+ "tcp:port=1234",
+ "unix:path=./boogie",
+ "tcp:host=localhost,port=1234",
+ "tcp:host=localhost,port=1234;tcp:port=5678",
+ "tcp:port=1234;unix:path=./boogie",
+ };
+
+ DBusServer *server;
+ int i;
+
+ for (i = 0; i < _DBUS_N_ELEMENTS (valid_addresses); i++)
+ {
+ server = dbus_server_listen (valid_addresses[i], NULL);
+ if (server == NULL)
+ _dbus_assert_not_reached ("Failed to listen for valid address.");
+
+ dbus_server_unref (server);
+
+ /* Try disconnecting before unreffing */
+ server = dbus_server_listen (valid_addresses[i], NULL);
+ if (server == NULL)
+ _dbus_assert_not_reached ("Failed to listen for valid address.");
+
+ dbus_server_disconnect (server);
+
+ dbus_server_unref (server);
+ }
+
+ return TRUE;
+}
+
+#endif /* DBUS_BUILD_TESTS */
Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- a/dbus-sysdeps.c 19 Apr 2004 22:09:55 -0000 1.70
+++ b/dbus-sysdeps.c 21 Apr 2004 22:13:07 -0000 1.71
@@ -687,9 +687,6 @@
return -1;
}
- if (host == NULL)
- host = "localhost";
-
he = gethostbyname (host);
if (he == NULL)
{
Index: dbus-test.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-test.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- a/dbus-test.c 2 Dec 2003 10:44:21 -0000 1.32
+++ b/dbus-test.c 21 Apr 2004 22:13:07 -0000 1.33
@@ -100,6 +100,12 @@
check_memleaks ();
+ printf ("%s: running server listen tests\n", "dbus-test");
+ if (!_dbus_server_test ())
+ die ("server listen");
+
+ check_memleaks ();
+
printf ("%s: running object tree tests\n", "dbus-test");
if (!_dbus_object_tree_test ())
die ("object tree");
Index: dbus-test.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-test.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- a/dbus-test.h 2 Dec 2003 10:44:21 -0000 1.24
+++ b/dbus-test.h 21 Apr 2004 22:13:07 -0000 1.25
@@ -42,6 +42,7 @@
dbus_bool_t _dbus_mem_pool_test (void);
dbus_bool_t _dbus_string_test (void);
dbus_bool_t _dbus_address_test (void);
+dbus_bool_t _dbus_server_test (void);
dbus_bool_t _dbus_message_test (const char *test_data_dir);
dbus_bool_t _dbus_auth_test (const char *test_data_dir);
dbus_bool_t _dbus_md5_test (void);
More information about the dbus-commit
mailing list