Commit graph

50 commits

Author SHA1 Message Date
Simon McVittie
e559663e03 test: Replace _dbus_assert_not_reached()
Assertions can be disabled; but in test code the assertions are the
entire point, so we don't want to disable them. Use _dbus_test_fatal()
instead.

test-service is actually a test helper rather than a test, so use its
pre-existing die() function instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-04-20 10:13:07 +01:00
Simon McVittie
ebe5744375 test-service: Write diagnostics to stderr
When run by a TAP test, stdout is reserved for machine-readable
TAP output.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-03 17:42:48 +00:00
Simon McVittie
f59b4f9226 test-utils: Separate failable and non-failable functions
test_object_try_whatever() now has libdbus-like OOM handling,
while test_object_whatever() has GLib-like OOM handling. This is
because an overwhelming majority of the callers of these functions
either didn't check for OOM anyway, or checked for it but then
aborted. In the uncommon case where we do care, we can use the _try_
version.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-12-04 11:52:52 +00:00
Simon McVittie
13b640544d Unix: Flush stdout and stderr streams before forking
stdout and stderr are close-on-exec and buffered, so we can't rely on
their buffers being empty. If we continue to execute application code
after forking (as opposed to immediately exec()ing), then the child
process might later flush the libc stdio buffers, resulting in
output that is printed by the parent also being printed by the child.

In particular, test-bus.log sometimes grows extremely large for
this reason, because this test repeatedly attempts to carry out
legacy activation.

Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
2017-11-15 12:12:18 +00:00
Philip Withnall
f88c8a8c39 test: Simplify error checking path in test-service slightly
This should shut up Coverity from complaining about not checking the
return value of dbus_set_error_from_message(), which is equivalent to
the (type == DBUS_MESSAGE_TYPE_ERROR) check.

Coverity ID: 54697
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99723
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2017-02-13 16:03:05 +00:00
Simon McVittie
7959d90719 Add missing function attributes suggested by clang (but not by gcc)
clang is a little more enthusiastic about suggesting these.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-10-13 22:44:13 +01:00
Simon McVittie
76ae52735e Remove trailing newlines from _dbus_assert_not_reached
This was never necessary: _dbus_assert_not_reached() always added one.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
2016-08-12 17:11:48 +01:00
Ralf Habacker
92c39d1d8a Fix of 'warning: variable ‘..‘ set but not used [-Wunused-but-set-variable]'.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-17 16:52:51 +01:00
Simon McVittie
565ae9dea9 test-service, test-shell-service: check what RequestName returned
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39231
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-08-05 12:26:48 +01:00
Marcus Brinkmann
dbecdeabb2 Consistently include <config.h> in all C source files and never in header files. 2010-03-19 20:11:48 +01:00
Colin Walters
7a4cd46284 Merge branch 'my-dbus-1.2'
Conflicts:
	bus/Makefile.am
	dbus/dbus-sysdeps-util-unix.c
	dbus/dbus-transport.c
	test/test-service.c
2010-01-28 17:09:15 -05:00
Colin Walters
b7e77c6b03 Ignore exit code zero from activated services
A variety of system components have migrated from legacy init into DBus
service activation.  Many of these system components "daemonize", which
involves forking.  The DBus activation system treated an exit as an
activation failure, assuming that the child process which grabbed the
DBus name didn't run first.

While we're in here, also differentiate in this code path between the
servicehelper (system) versus direct activation (session) paths.  In
the session activation path our error message mentioned a helper
process which was confusing, since none was involved.

Based on a patch and debugging research from Ray Strode <rstrode@redhat.com>
2010-01-28 17:01:24 -05:00
Ralf Habacker
be51ff7e5e windows does not support fork, skip it 2009-12-18 16:45:50 +01:00
Colin Walters
949a64b127 Ignore exit code zero from activated services
A variety of system components have migrated from legacy init into DBus
service activation.  Many of these system components "daemonize", which
involves forking.  The DBus activation system treated an exit as an
activation failure, assuming that the child process which grabbed the
DBus name didn't run first.

While we're in here, also differentiate in this code path between the
servicehelper (system) versus direct activation (session) paths.  In
the session activation path our error message mentioned a helper
process which was confusing, since none was involved.

Based on a patch and debugging research from Ray Strode <rstrode@redhat.com>
2009-12-15 13:08:02 -05:00
Ralf Habacker
fd049c3455 use dbus provided wait function 2009-11-30 16:00:20 +01:00
Colin Walters
576a87dc5a Add missing include for unistd.h in test-service.c
We use usleep here.
(cherry picked from commit e5310abd6c)
2009-07-14 15:39:33 -04:00
Scott James Remnant
0539a23c66 Add tests for pending call timeouts
* test/test-service.c (handle_delay_echo, path_message_func): Add a
  variant of the Echo method which sleeps for a short time.
* test/name-test/test-pending-call-timeout.c: Run tests with default,
  specified and infinite timeout to make sure we get the reply.
* test/name-test/run-test.sh: Run the new test
* test/name-test/Makefile.am: Build the new test

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit c1f165261a)
2009-07-14 15:38:42 -04:00
Colin Walters
e5310abd6c Add missing include for unistd.h in test-service.c
We use usleep here.
2009-07-10 19:22:54 -04:00
Scott James Remnant
c1f165261a Add tests for pending call timeouts
* test/test-service.c (handle_delay_echo, path_message_func): Add a
  variant of the Echo method which sleeps for a short time.
* test/name-test/test-pending-call-timeout.c: Run tests with default,
  specified and infinite timeout to make sure we get the reply.
* test/name-test/run-test.sh: Run the new test
* test/name-test/Makefile.am: Build the new test

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-05-28 11:47:38 +02:00
Havoc Pennington
7020b57376 2006-10-01 Havoc Pennington <hp@redhat.com>
* test/test-service.c (path_message_func): remove broken extra
	unref that was hidden by the bugs in dbus-connection.c/dbus-bus.c

	* test/test-shell-service.c (path_message_func): same fix

	* dbus/dbus-connection.c
	(_dbus_connection_get_dispatch_status_unlocked): break up the
	function a little for clarity and fix the notification of
	dbus-bus.c to not require dispatch to be complete

	* dbus/dbus-connection.c (dbus_connection_unref): improve the
	warning when you try to finalize an open connection.
2006-10-01 17:21:03 +00:00
John (J5) Palmieri
1eae184450 * doc/TODO:
- Remove pending call locking todo item
- dbus_connection_open now holds hard ref.  Remove todo item
- do proper locking on _dbus_bus_check_connection_and_unref
  and handle DBUS_BUS_STARTER. Remove todo item
- Warn on closing of a shared connection.  Remove todo item

* bus/bus.c, bus/connection.c, bus/dispatch.c, dbus/dbus-bus.c,
  dbus/dbus-connection.c: Use the dbus_connection_close_internal
  so we don't get the warning when closing shared connections

* test/test-service.c, test/test-shell-service.c: Applications
  don't close shared connections themselves so we unref instead of
  close

* test/test-utils.c (test_connection_shutdown): Close the connection

* dbus/dbus-bus.c (_dbus_bus_check_connection_and_unref): Changed to
  _dbus_bus_check_connection_and_unref_unlocked since we only call this
  method on a locked connection.
  Make sure we call _dbus_connection_unref_unlocked instead of
  dbus_connection_unref also.
  Handle DBUS_BUS_STARTER correctly

* dbus/dbus-connection.c (connection_record_shared_unlocked):
  Mark as shared and hard ref the connection
  (connection_forget_shared_unlocked): Remove the hard ref from the
  connection
  (_dbus_connection_close_internal_and_unlock):  New internal function
  which takes a locked connection and unlocks it after closing it
  (_dbus_connection_close_internal): New internal function which acts
  like the origonal dbus_connection_close method by grabbing a connection
  lock and calling _dbus_connection_close_internal_and_unlock
  (dbus_connection_close): Public close method, warns when the app
  trys to close a shared connection
2006-09-06 22:00:07 +00:00
Havoc Pennington
afc2a6e56a 2006-08-29 Havoc Pennington <hp@redhat.com>
* test/test-service.c (path_message_func): fix lack of return value

	* dbus/dbus-sysdeps.c (_dbus_printf_string_upper_bound): fix
	formatting, remove #ifdef, and fix docs. #ifdef doesn't make
	any more sense than on anything else in this file.
	(_dbus_get_tmpdir): add const to return value, and keep the
	results of the various getenv around in a static variable.
2006-08-30 01:27:44 +00:00
John (J5) Palmieri
c1091cbbd2 Patches by Kjartan Maraas <kmaraas at gnome dot org>
* bus/services.c (bus_service_list_queued_owners):
        Add a pointer cast to fix compiler warning

        * dbus/dbus-dataslot.c (_dbus_data_slot_list_get):
        return a NULL instead of FALSE since the return type
        is not expecting a boolean

        * dbus/dbus-marshal-basic.c (_dbus_marshal_test):
        Remove unused variable

        * dbus/dbus-marshal-recursive-util.c (node_new):
        return a NULL instead of FALSE since the return type
        is not expecting a boolean

        * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new):
        Send a NULL into _dbus_transport_new_for_fd instead of a FALSE
        because we are expecting a pointer not a boolean

        * dbus/dbus-sysdeps-util.c (_dbus_get_tmpdir):
        add void as the parameter so some compilers
        don't complain

        * dbus/dbus-transport-unix.c (_dbus_transport_new_for_domain_socket,
          _dbus_transport_new_for_tcp_socket):
        Send a NULL into _dbus_transport_new_for_fd instead of a FALSE
        because we are expecting a pointer not a boolean

        * test/shell-test.c (test_command_line):
        cast the second argument to _dbus_list_append to avoid compiler
        warnings

        * test/test-names.c (main): remove unused variable

        * test/test-service.c (check_hello_from_self_reply):
        Initialize echo_message and echo_reply to NULL

        * test/test-shell-service.c (handle_echo):
        Remove unused variable and cast the third parameter passed to
        dbus_connection_get_object_path_data to avoid compiler warrnings

        * test/name-test/test-names.c (clear_message_queue):
        Remove unused function

        * test/name-test/test-pending-call-dispatch.c:
        Fix format string in printf
2006-08-14 19:11:35 +00:00
John (J5) Palmieri
a7595655fb * bus/dispatch.c, test/test-service.c: Add testcase
for sending messages to oneself (TODO item).

* python/service.py (class Object): Swap ordering of bus_name
  and object_path parameters to better support inheritance.

* doc/dbus-tutorial.xml: change Python docs to reflect change
  in parameter ordering and fix the inheritance section.

* doc/TODO: remove sending message to oneself TODO item
2005-07-15 15:21:43 +00:00
John (J5) Palmieri
f03c0af1c7 * tools/dbus-send.c (main):
s/dbus_connection_disconnect/dbus_connection_close

	* test/glib/test-profile.c (no_bus_thread_func, with_bus_thread_func):
	s/dbus_connection_disconnect/dbus_connection_close

	* test/test-service.c (path_message_func, filter_func):
	s/dbus_connection_disconnect/dbus_connection_close
2005-06-02 18:22:04 +00:00
Havoc Pennington
64f3d8f67d 2005-04-23 Havoc Pennington <hp@redhat.com>
* dbus/dbus-message.c (dbus_message_append_args): fix doc comment,
	reported by Tony Houghton

	* test/test-service.c (main): test
	dbus_connection_get_object_path_data()

	* dbus/dbus-object-tree.c (find_handler): be sure we always init
	the exact_match
	(_dbus_object_tree_get_user_data_unlocked): new function used by
	dbus_connection_get_object_path_data()
	(do_register): add assertion test for get_user_data_unlocked
	(object_tree_test_iteration): more tests

	* dbus/dbus-connection.c (dbus_connection_get_object_path_data):
	new function from Dan Reed to let you get the user data from
	dbus_connection_register_object_path()
2005-04-24 14:04:16 +00:00
Colin Walters
248895207d 2005-02-17 Colin Walters <walters@verbum.org>
* dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS):
	Rename to DBUS_SERVICE_DBUS.
	(DBUS_PATH_ORG_FREEDESKTOP_DBUS): Rename to DBUS_PATH_DBUS.
	(DBUS_PATH_ORG_FREEDESKTOP_LOCAL): Rename to DBUS_PATH_LOCAL.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS): Rename to DBUS_INTERFACE_DBUS.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_INTROSPECTABLE): Rename to
	DBUS_INTERFACE_INTROSPECTABLE.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_PROPERTIES): Rename to
	DBUS_INTERFACE_PROPERTIES.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_PEER): Rename to
	DBUS_INTERFACE_PEER.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL):
	DBUS_INTERFACE_LOCAL.

	All other users of those constants have been changed.

	* bus/driver.c (bus_driver_handle_introspect): Use constants.

	* glib/dbus-gobject.c (handle_introspect): Use constants.

	* doc/dbus-faq.xml, doc/dbus-specification.xml: Update for rename.
2005-02-17 21:19:49 +00:00
Havoc Pennington
8873c90f99 2005-01-18 Havoc Pennington <hp@redhat.com>
* Throughout, grand renaming to strip out the use of "service",
	just say "name" instead (or "bus name" when ambiguous).  Did not
	change the internal code of the message bus itself, only the
	programmer-facing API and messages.

	* doc/dbus-specification.xml: further update the message bus section

	* bus/config-parser.c (all_are_equiv): fix bug using freed string
	in error case
2005-01-18 20:42:15 +00:00
Havoc Pennington
9c3d566e95 2005-01-15 Havoc Pennington <hp@redhat.com>
* Land the new message args API and type system.

	This patch is huge, but the public API change is not
	really large. The set of D-BUS types has changed somewhat,
	and the arg "getters" are more geared toward language bindings;
	they don't make a copy, etc.

	There are also some known issues. See these emails for details
	on this huge patch:
	http://lists.freedesktop.org/archives/dbus/2004-December/001836.html
        http://lists.freedesktop.org/archives/dbus/2005-January/001922.html

	* dbus/dbus-marshal-*: all the new stuff

	* dbus/dbus-message.c: basically rewritten

	* dbus/dbus-memory.c (check_guards): with "guards" enabled, init
	freed blocks to be all non-nul bytes so using freed memory is less
	likely to work right

	* dbus/dbus-internals.c (_dbus_test_oom_handling): add
	DBUS_FAIL_MALLOC=N environment variable, so you can do
	DBUS_FAIL_MALLOC=0 to skip the out-of-memory checking, or
	DBUS_FAIL_MALLOC=10 to make it really, really, really slow and
	thorough.

	* qt/message.cpp: port to the new message args API
	(operator<<): use str.utf8() rather than str.unicode()
	(pretty sure this is right from the Qt docs?)

	* glib/dbus-gvalue.c: port to the new message args API

	* bus/dispatch.c, bus/driver.c: port to the new message args API

	* dbus/dbus-string.c (_dbus_string_init_const_len): initialize the
	"locked" flag to TRUE and align_offset to 0; I guess we never
	looked at these anyhow, but seems cleaner.

	* dbus/dbus-string.h (_DBUS_STRING_ALLOCATION_PADDING):
	move allocation padding macro to this header; use it to implement
	(_DBUS_STRING_STATIC): ability to declare a static string.

	* dbus/dbus-message.c (_dbus_message_has_type_interface_member):
	change to return TRUE if the interface is not set.

	* dbus/dbus-string.[hc]: move the D-BUS specific validation stuff
	to dbus-marshal-validate.[hc]

	* dbus/dbus-marshal-basic.c (_dbus_type_to_string): move here from
	dbus-internals.c

	* dbus/Makefile.am: cut over from dbus-marshal.[hc]
	to dbus-marshal-*.[hc]

	* dbus/dbus-object-tree.c (_dbus_decompose_path): move this
	function here from dbus-marshal.c
2005-01-15 07:15:38 +00:00
Havoc Pennington
f7beca572b 2004-06-07 Havoc Pennington <hp@redhat.com>
* dbus/dbus-message-builder.c (_dbus_message_data_load): append
	random signature when using REQUIRED_FIELDS (this hack won't work
	in the long term)

	* dbus/dbus-message.c: change the signature to be a header field,
	instead of message->signature special-case string. Incremental
	step forward. Then we can fix up code to send the signature in the
	message, then fix up code to validate said signature, then fix up
	code to not put the typecodes inline, etc.
	(load_one_message): don't make up the signature after the fact
	(decode_header_data): require signature field for the known
	message types

	* dbus/dbus-marshal.c (_dbus_marshal_string_len): new

	* dbus/dbus-protocol.h: add DBUS_HEADER_FIELD_SIGNATURE
2004-06-07 19:27:51 +00:00
Olivier Andrieu
96f6740f2f 2004-06-05 Olivier Andrieu <oliv__a@users.sourceforge.net>
* dbus/dbus-connection.h, dbus/dbus-connection.c: have object path
	registration functions take the path argument as char* instead of
	char**.

	* dbus/dbus-marshal.h, dbus/dbus-marshal.c (_dbus_decompose_path):
	split off the path decompostion part of
	_dbus_demarshal_object_path. Some misc. fixes to silence compiler
	warnings.

	* glib/dbus-gobject.c, test/test-service.c: update accordingly.
2004-06-05 16:32:00 +00:00
Havoc Pennington
2195cf0dbd 2004-03-21 Havoc Pennington <hp@redhat.com>
* test/test-service.c (main): remove debug spew
2004-03-21 16:26:56 +00:00
Havoc Pennington
7574224200 2003-10-20 Havoc Pennington <hp@redhat.com>
hmm, make check is currently not passing.

	* doc/dbus-specification.xml: add requirement that custom type
	names follow the same rules as interface names.

	* dbus/dbus-protocol.h: change some of the byte codes, to avoid
	duplication and allow 'c' to be 'custom'; dict is now 'm' for
	'map'

	* doc/dbus-specification.xml: update type codes to match
	dbus-protocol.h, using the ASCII byte values. Rename type NAMED to
	CUSTOM. Add type OBJECT_PATH to the spec.

2003-10-17  Havoc Pennington  <hp@redhat.com>

	* bus/driver.c (create_unique_client_name): use "." as separator
	in base service names instead of '-'

	* dbus/dbus-string.c (_dbus_string_get_byte): allow getting nul
	byte at the end of the string

	* dbus/dbus-internals.h (_DBUS_LIKELY, _DBUS_UNLIKELY): add
	optimization macros since string validation seems to be a slow
	point.

	* doc/dbus-specification.xml: restrict valid
	service/interface/member/error names. Add test suite code for the
	name validation.

	* dbus/dbus-string.c: limit service/interface/member/error names
	to [0-9][A-Z][a-z]_

	* dbus/dbus-connection.c (dbus_connection_dispatch): add missing
	format arg to verbose spew

	* glib/dbus-gproxy.c (dbus_gproxy_call_no_reply): if not out of
	memory, return instead of g_error

	* test/test-service.c (path_message_func): support emitting a
	signal on request

	* dbus/dbus-bus.c (init_connections_unlocked): only fill in
	activation bus type if DBUS_BUS_ACTIVATION was set; default to
	assuming the activation bus was the session bus so that services
	started manually will still register.
	(init_connections_unlocked): fix so that in OOM situation we get
	the same semantics when retrying the function

	* test/test-service.c (main): change to use path registration, to
	test those codepaths; register with DBUS_BUS_ACTIVATION rather
	than DBUS_BUS_SESSION
2003-10-21 05:46:52 +00:00
Havoc Pennington
d6e1b2adb3 2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
	execute, not both
	(bus_connections_check_reply): use unlink, not remove_link, as we
	don't want to free the link; fixes double free mess

	* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
	where no reply was received

	* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
	fix a refcount leak

	* bus/signals.c (match_rule_matches): add special cases for the
	bus driver, so you can match on sender/destination for it.

	* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
	DBUS_PRINT_BACKTRACE is set

	* dbus/dbus-internals.c: add pid to assertion failure messages

	* dbus/dbus-connection.c: add message type code to the debug spew

	* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
	sender=foo not service=foo

	* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
	session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
	DBUS_ACTIVATION_ADDRESS instead

	* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
	DBUS_SYSTEM_BUS_ADDRESS if appropriate

	* bus/bus.c (bus_context_new): handle OOM copying bus type into
	context struct

	* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
	(dbus_message_iter_get_object_path_array): new function (half
	finished, disabled for the moment)

	* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
	DBUS_MESSAGE_TYPE_ERROR

	* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
	avoid redirecting stderr to /dev/null
	(babysit): close stdin if not doing the "exit_with_session" thing

	* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
	debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
	stdout/stdin, so things don't get confused

	* bus/system.conf.in: fix to allow replies, I modified .conf
	instead of .conf.in again.
2003-10-16 06:34:51 +00:00
Seth Nickell
f4cffc0e49 2003-09-21 Seth Nickell <seth@gnome.org>
First checkin of the Python bindings.

	* python/.cvsignore:
	* python/Makefile.am:
	* python/dbus_bindings.pyx.in:
	* python/dbus_h_wrapper.h:

	Pieces for Pyrex to operate on, building a dbus_bindings.so
	python module for low-level access to the DBus APIs.

	* python/dbus.py:

	High-level Python module for accessing DBus objects.

	* configure.in:
	* Makefile.am:

	Build stuff for the python bindings.

	* acinclude.m4:

	Extra macro needed for finding the Python C header files.
2003-09-22 05:45:59 +00:00
Havoc Pennington
1dd3f1788f 2003-08-30 Havoc Pennington <hp@pobox.com>
* dbus/dbus-connection.c: purge DBusMessageHandler

	* dbus/dbus-message-handler.c: remove DBusMessageHandler, just
	use callbacks everywhere
2003-08-31 03:25:24 +00:00
Havoc Pennington
68a3c593b9 2003-08-18 Havoc Pennington <hp@redhat.com>
* dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix

	* dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix
	dumb bug created earlier (wrong order of args to
	decode_header_data())

	* tools/dbus-send.c: port

	* tools/dbus-print-message.c (print_message): port

        * test/data/*messages: port all messages over

        * dbus/dbus-message-builder.c: support including
	message type

        * bus/driver.c: port over

	* bus/dispatch.c: port over to new stuff

	* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
	rename disconnect signal to "Disconnected"
2003-08-18 22:43:30 +00:00
Havoc Pennington
5c1a8e4490 2003-08-11 Havoc Pennington <hp@pobox.com>
* bus/test.c (client_disconnect_handler): change to return
	HANDLED (would have been REMOVE_MESSAGE)

	* dbus/dbus-object.h (enum DBusHandlerResult): rename to
	HANDLED/NOT_YET_HANDLED instead of
	REMOVE_MESSAGE/ALLOW_MORE_HANDLERS to make it clearer how it
	should be used.
2003-08-12 02:43:50 +00:00
Havoc Pennington
b29ea9115e 2003-08-10 Havoc Pennington <hp@pobox.com>
* tools/dbus-send.c (main): add --type argument, for now
	supporting only method_call and signal types.

	* tools/dbus-print-message.c: print message type

	* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
	init connection->objects

	* doc/dbus-specification.sgml: fix sgml

	* bus/*.c: port over to object-instance API changes

	* test/test-service.c: ditto

	* dbus/dbus-message.c (dbus_message_create_header): allow #NULL
	name, we will have to fix up the rest of the code to also handle
	this
	(dbus_message_new): generic message-creation call
	(set_string_field): allow appending name field
2003-08-11 02:11:58 +00:00
Havoc Pennington
1820f3bd0a 2003-04-24 Havoc Pennington <hp@redhat.com>
* bus/dispatch.c: somehow missed some name_is

	* dbus/dbus-timeout.c (_dbus_timeout_set_enabled)
	(_dbus_timeout_set_interval): new

	* bus/connection.c (bus_connections_setup_connection): record time
	when each connection is first set up, and expire them after the
	auth timeout passes.
2003-04-24 21:26:25 +00:00
Havoc Pennington
77eac31aee 2003-04-11 Havoc Pennington <hp@pobox.com>
* test/decode-gcov.c: add "below average functions" to the
	coverage report, and change how some of the code works.

	* bus/test-main.c: bracket some stuff in DBUS_BUILD_TESTS so it's
	not in the coverage stats.

	* test/test-service.c (main): use _dbus_verbose not fprintf in a
	couple places so running the test suite doesn't result in megaspam.
2003-04-11 04:52:29 +00:00
Havoc Pennington
6be547d32f 2003-04-10 Havoc Pennington <hp@redhat.com>
* dbus/dbus-connection.c (dbus_connection_flush): don't spin on
	the connection if it's disconnected

	* bus/activation.c (bus_activation_service_created): use new
	transaction features to roll back removal of pending activation if
	we don't successfully create the service after all. Don't remove
	pending activation if the function fails.

	* dbus/dbus-list.c (_dbus_list_insert_before_link)
	(_dbus_list_insert_after_link): new code to facilitate
	services.c fixes

	* dbus/dbus-hash.c (_dbus_hash_table_insert_string_preallocated):
	new functionality, so we can preallocate the ability to insert
	into a hash table.

	* bus/connection.c (bus_transaction_add_cancel_hook): new function
	allowing us to put custom hooks in a transaction to be used for
	cancelling said transaction

	* doc/dbus-specification.sgml: add some discussion of secondary
	service owners, and disallow zero-length service names

	* bus/services.c (bus_registry_acquire_service): new function,
	splits out part of bus_driver_handle_acquire_service() and fixes
	a bug where we didn't remove the service doing the acquiring
	from the secondary queue if we failed to remove the current owner
	from the front of the queue.
2003-04-11 00:03:06 +00:00
Havoc Pennington
51781f5410 2003-04-10 Havoc Pennington <hp@pobox.com>
* bus/dispatch.c: lots of fixes

	* dbus/dbus-mainloop.c (_dbus_loop_dispatch): export
	(_dbus_loop_iterate): remove old "quit if no callbacks" code,
	that was crack, broke the test service.

	* dbus/dbus-transport.c (_dbus_transport_open): fix error
	handling to avoid piling up errors if we get a failure on the
	first address.

	* dbus/dbus-internals.c (_dbus_real_assert_not_reached): include
	pid in assertion failures.

	* dbus/dbus-mainloop.c (_dbus_loop_iterate): use static arrays up
	to some fixed size of file descriptor array. Don't return TRUE
	anytime a timeout exists, that led to lots of busy loop silliness
	in the tests.
2003-04-10 05:12:19 +00:00
Havoc Pennington
1708094c0e 2003-04-09 Havoc Pennington <hp@redhat.com>
* dbus/dbus-bus.c (dbus_bus_register): fix up error handling and
	a memory leak

	* bus/dispatch.c (check_service_activated): fix bug in test

	* dbus/dbus-mainloop.c (check_timeout): fix this up

	* dbus/dbus-internals.c (_dbus_verbose_real): include PID in
	verbose output so we can sort out output from different processes,
	e.g. in the activation case.
2003-04-09 20:31:21 +00:00
Alexander Larsson
c5020ac870 2003-04-08 Alexander Larsson <alexl@redhat.com>
Implemented recursive types, named types and new-style iters

	* bus/driver.c:
	* glib/test-thread-client.c: (thread_func):
	* glib/test-thread-server.c: (handle_test_message):
	* test/test-service.c: (handle_echo):
	Update to new api

	* dbus/Makefile.am:
	* dbus/dbus-dict.c:
	* dbus/dbus-dict.h:
	* dbus/dbus.h
	Remove DBusDict

	* dbus/dbus-internals.c: (_dbus_type_to_string):
	Update for new types.

	* dbus/dbus-marshal.[ch]:
	Implement recursive types and the new marshalling format.
	Remove hardcoded dict marshalling.
	Marshal named types.

	* dbus/dbus-message-builder.c:
	Add BYTE_ARRAY.
	Remove references to old types

	* dbus/dbus-message.[ch]:
	New non-refcounted iter API that supports recursive iters.
	Use iters for appending, including support for recursive
	iters.
	Add byte and named type support.
	Update everything to new marshalling formats.
	Add tests for new API.

	* dbus/dbus-protocol.h:
	Remove old array types.
	Add types: BYTE, ARRAY, DICT, NAMED

	* dbus/dbus-string.c:
	* dbus/dbus-sysdeps.c:
	Make parse_double locale safe.

	* dbus/dbus-test-main.c:
	Call setlocale.

	* dbus/dbus-test.c:
	Kill dict test

	* doc/dbus-specification.sgml:
	Update spec

	* test/data/incomplete-messages/missing-body.message:
	* test/data/invalid-messages/bad-boolean.message:
	* test/data/invalid-messages/bad-boolean-array.message:
	* test/data/invalid-messages/boolean-array-length-too-long.message-raw:
	* test/data/invalid-messages/boolean-has-no-value.message-raw:
	* test/data/invalid-messages/too-short-dict.message:
	* test/data/valid-messages/dict-simple.message:
	* test/data/valid-messages/dict.message:
	* test/data/valid-messages/emptiness.message:
	* test/data/valid-messages/lots-of-arguments.message:
	* test/data/valid-messages/no-padding.message:
	* test/data/valid-messages/recursive-types.message:
	Add missing NAME fields
	Fix up dicts & arrays

	* test/data/invalid-messages/dict-with-nil-value.message:
	Removed, this is not invalid anymore.

	* test/data/valid-messages/recursive-types.message:
	Add new test for deeply recursive types.
2003-04-08 15:52:51 +00:00
Havoc Pennington
fe22b2194d 2003-04-07 Havoc Pennington <hp@redhat.com>
* doc/dbus-specification.sgml: require that base service names
	start with ':' and that the base service is created/deleted
	as first and last things a connection does on the bus

	* bus/dispatch.c (check_existent_service_activation): lots more
	work on the activation test; it doesn't fully pass yet...

	* test/test-service.c (main): fix so we don't memleak the
	connection to the message bus
	(filter_func): accept a message asking us to exit
2003-04-07 23:28:16 +00:00
Havoc Pennington
a7f69a41d5 2003-04-06 Havoc Pennington <hp@pobox.com>
* qt/Makefile.am (dbusinclude_HEADERS): install dbus-qt.h,
	from Colin Walters

	* configure.in: fixes to Qt detection from Colin Walters

	* doc/Makefile.am: Only remove generated docbook dirs if they
	exist, from Colin Walters

	* dbus/dbus-bus.c: change how we set well-known connections to
	NULL, so that it works if a single connection is stored in
	two well-known array slots.

	* test/Makefile.am: remove a lot of stuff that isn't immediately
	useful, it's in CVS history if we want it.

	* test/test-service.c: use dbus-mainloop instead of that
	watch.[hc] crack
2003-04-07 02:01:53 +00:00
Havoc Pennington
98572905e6 2003-04-06 Havoc Pennington <hp@pobox.com>
* test/Makefile.am: remove a lot of stuff that isn't immediately
	useful, it's in CVS history if we want it.

	* test/test-service.c: use dbus-mainloop instead of that
	watch.[hc] crack
2003-04-07 01:07:13 +00:00
Havoc Pennington
f216e81432 2003-04-03 Havoc Pennington <hp@redhat.com>
* bus/activation.c (load_directory): fix up memleaks
	(bus_activation_entry_free): free the entry

	* dbus/dbus-bus.c (dbus_bus_acquire_service): return an error if
	we get one from the message bus; fix memleaks.

	* dbus/dbus-message.c (dbus_set_error_from_message): new function
2003-04-03 21:56:22 +00:00
Havoc Pennington
eeb88949d8 2003-04-03 Havoc Pennington <hp@pobox.com>
* bus/config-parser.c (bus_config_parser_unref): free
	list of mechanisms, bug discovered by test suite enhancements
	(putting system.conf and session.conf into suite)

	* test/Makefile.am, test/test-service.c: add placeholder for a
	test service that we'll activate as part of test suite. Doesn't
	do anything yet.

	* dbus/dbus-sysdeps.c (_dbus_setenv): support unsetenv by
	setting NULL value, and use system malloc not dbus_malloc()
	when we have unavoidable memleakage.

	* dbus/dbus-bus.c (dbus_bus_get): fix bug where bus type of 0
	didn't work, and support DBUS_BUS_ACTIVATION.

	* bus/activation.c (child_setup): pass our well-known bus type to
	the child

	* bus/config-parser.c: support <type> to specify well-known type

	* doc/dbus-specification.sgml: document the env variables to
	locate well-known buses and find service activator
2003-04-03 05:22:49 +00:00