1. 31 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-30 Havoc Pennington <hp@pobox.com> · bc86794f
      Havoc Pennington authored
      	* bus/config-parser.c: hacking
      
      	* dbus/dbus-memory.c: don't use DBusList for the list of stuff
      	to shut down, since it could cause weirdness with the DBusList
      	lock
      
      	* dbus/dbus-list.c (_dbus_list_test): add tests for the
      	link-oriented stack routines
      	(alloc_link): free the mempool if the first alloc from it fails
      
      	* dbus/dbus-mempool.c (struct DBusMemBlock): fix alignment issue
      
      	* dbus/dbus-string.c (UNICODE_VALID): sync new version of this
      	from GLib
      	(_dbus_string_skip_white): new
      
      	* doc/config-file.txt (Elements): add <includedir>
      bc86794f
  2. 24 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-23 Havoc Pennington <hp@pobox.com> · c3af5ccd
      Havoc Pennington authored
      	* dbus/dbus-threads.c (dbus_mutex_new, dbus_condvar_new): with
      	DBUS_BUILD_TESTS, actually alloc/free a block of memory for
      	the mutex, so we can check for proper memory management
      	and OOM handling.
      
      	* dbus/dbus-dataslot.c: remove the mutex from
      	DBusDataSlotAllocator and lock it manually when using it,
      	to simplify fitting it into the global slots framework.
      
      	* dbus/dbus-threads.c (init_static_locks): rework how we're
      	handling global locks so they are easily shut down.
      
      	* bus/policy.c (bus_policy_append_rule): fix
      
      	* bus/test-main.c (main): check for memleaks
      
      	* dbus/dbus-test.c (dbus_internal_do_not_use_run_tests): make
      	test suite check for memleaks
      
      	* dbus/dbus-memory.c: add support in test mode for tracking
      	number of outstanding blocks
      c3af5ccd
  3. 16 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-16 Havoc Pennington <hp@pobox.com> · ce173b29
      Havoc Pennington authored
      	Oops - test code was only testing failure of around 30 of the
      	mallocs in the test path, but it turns out there are 500+
      	mallocs. I believe this was due to misguided linking setup such
      	that there was one copy of dbus_malloc etc. in the daemon and one
      	in the shared lib, and only daemon mallocs were tested. In any
      	case, the test case now tests all 500+ mallocs, and doesn't pass
      	yet, though there are lots of fixes in this patch.
      
      	* dbus/dbus-connection.c (dbus_connection_dispatch_message): fix
      	this so that it doesn't need to allocate memory, since it
      	has no way of indicating failure due to OOM (and would be
      	annoying if it did).
      
      	* dbus/dbus-list.c (_dbus_list_pop_first_link): new function
      
      	* bus/Makefile.am: rearrange to create two self-contained
      	libraries, to avoid having libraries with overlapping symbols.
      	that was resulting in weirdness, e.g. I'm pretty sure there
      	were two copies of global static variables.
      
      	* dbus/dbus-internals.c: move the malloc debug stuff to
      	dbus-memory.c
      
      	* dbus/dbus-list.c (free_link): free list mempool if it becomes
      	empty.
      
      	* dbus/dbus-memory.c (_dbus_disable_mem_pools): new function
      
      	* dbus/dbus-address.c (dbus_parse_address): free list nodes
      	on failure.
      
      	* bus/dispatch.c (bus_dispatch_add_connection): free
      	message_handler_slot when no longer using it, so
      	memory leak checkers are happy for the test suite.
      
      	* dbus/dbus-server-debug-pipe.c (debug_finalize): free server name
      
      	* bus/bus.c (new_connection_callback): disconnect in here if
      	bus_connections_setup_connection fails.
      
      	* bus/connection.c (bus_connections_unref): fix to free the
      	connections
      	(bus_connections_setup_connection): if this fails, don't
      	disconnect the connection, just be sure there are no side
      	effects.
      
      	* dbus/dbus-string.c (undo_alignment): unbreak this
      
      	* dbus/dbus-auth.c (_dbus_auth_unref): free some stuff we were
      	leaking
      	(_dbus_auth_new): fix the order in which we free strings
      	on OOM failure
      
      	* bus/connection.c (bus_connection_disconnected): fix to
      	not send ServiceDeleted multiple times in case of memory
      	allocation failure
      
      	* dbus/dbus-bus.c (dbus_bus_get_base_service): new function to
      	get the base service name
      	(dbus_bus_register_client): don't return base service name,
      	instead store it on the DBusConnection and have an accessor
      	function for it.
      	(dbus_bus_register_client): rename dbus_bus_register()
      
      	* bus/dispatch.c (check_hello_message): verify that other
      	connections on the bus also got the correct results, not
      	just the one sending hello
      ce173b29
  4. 13 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-12 Havoc Pennington <hp@redhat.com> · 29560adc
      Havoc Pennington authored
              Mega-patch that gets the message bus daemon initially handling
      	out-of-memory. Work still needed. Also lots of random
      	moving stuff to DBusError instead of ResultCode.
      
      	* dbus/dbus-list.c (_dbus_list_length_is_one): new function
      
      	* dbus/dbus-connection.c
      	(dbus_connection_send_with_reply_and_block): use DBusError
      
      	* dbus/dbus-bus.c: adapt to API changes, make it use DBusError not
      	DBusResultCode
      
      	* dbus/dbus-connection.c (dbus_connection_send): drop the result
      	code here, as the only failure possible is OOM.
      
      	* bus/connection.c (bus_connection_disconnect):
      	rename bus_connection_disconnected as it's a notification only
      
      	* bus/driver.c (bus_driver_handle_acquire_service): don't free
      	"name" on get_args failure, should be done by get_args;
      	don't disconnect client for bad args, just return an error.
      	(bus_driver_handle_service_exists): ditto
      
      	* bus/services.c (bus_services_list): NULL-terminate returned array
      
      	* bus/driver.c (bus_driver_send_service_lost)
      	(bus_driver_send_service_acquired): send messages from driver to a
      	specific client to the client's unique name, not to the broadcast
      	service.
      
      	* dbus/dbus-message.c (decode_header_data): reject messages that
      	contain no name field
      	(_dbus_message_get_client_serial): rename to
      	dbus_message_get_serial and make public
      	(_dbus_message_set_serial): rename from set_client_serial
      	(_dbus_message_set_reply_serial): make public
      	(_dbus_message_get_reply_serial): make public
      
      	* bus/connection.c (bus_connection_foreach): allow stopping
      	iteration by returning FALSE from foreach function.
      
      	* dbus/dbus-connection.c (dbus_connection_send_preallocated)
      	(dbus_connection_free_preallocated_send)
      	(dbus_connection_preallocate_send): new API for sending a message
      	without possibility of malloc failure.
      	(dbus_connection_send_message): rename to just
      	dbus_connection_send (and same for whole function family)
      
      	* dbus/dbus-errors.c (dbus_error_free): make this reinit the error
      
      	* dbus/dbus-sysdeps.c (_dbus_exit): new function
      
      	* bus/activation.c: handle/return errors
      
      	* dbus/dbus-errors.h: add more DBUS_ERROR #define
      
      	* dbus/dbus-sysdeps.c (_dbus_directory_open) (_dbus_file_get_contents)
      	(_dbus_directory_get_next_file): use DBusError instead of DBusResultCode
      	(_dbus_result_from_errno): move to this file
      29560adc
  5. 19 Feb, 2003 1 commit
    • Havoc Pennington's avatar
      2003-02-19 Havoc Pennington <hp@pobox.com> · c21511c0
      Havoc Pennington authored
      	Throughout: mop up all the Doxygen warnings and undocumented
      	stuff.
      
      	* dbus/dbus-sysdeps.c (do_exec): do not use execvp, we don't want
      	to search any paths.
      
      	* dbus/dbus-threads.c: move global mutex initializers to
      	dbus-internals.h, multiple prototypes was confusing doxygen
      	besides being kind of ugly
      
      	* Doxyfile (PREDEFINED): have Doxygen define
      	DOXYGEN_SHOULD_SKIP_THIS so we can exclude things from
      	docs with #ifndef DOXYGEN_SHOULD_SKIP_THIS
      	(do not abuse the feature! it's for stuff like the autogenerated
      	macros in dbus-md5.c, not just for things you don't feel like
      	documenting...)
      c21511c0
  6. 15 Feb, 2003 3 commits
    • Anders Carlsson's avatar
      2003-02-15 Anders Carlsson <andersca@codefactory.se> · 30265b80
      Anders Carlsson authored
      	* dbus/dbus-list.c: (_dbus_list_append_link),
      	(_dbus_list_prepend_link):
      	* dbus/dbus-memory.c: (dbus_malloc), (dbus_malloc0),
      	(dbus_realloc):
      	Warning fixes.
      30265b80
    • Anders Carlsson's avatar
      2003-02-15 Anders Carlsson <andersca@codefactory.se> · 0c502d5b
      Anders Carlsson authored
      	* dbus/dbus-internals.h:
      	Fix build without tests.
      
      	* dbus/dbus-list.c: (alloc_link):
      	Fix a segfault when a malloc fails.
      
      	* dbus/dbus-memory.c: (initialize_malloc_debug), (dbus_malloc),
      	(dbus_malloc0), (dbus_realloc):
      	Add support for malloc debugging.
      0c502d5b
    • Alexander Larsson's avatar
      2003-02-15 Alexander Larsson <alexl@redhat.com> · fe401894
      Alexander Larsson authored
      	* dbus/dbus-threads.c:
      	* dbus/dbus-threads.h:
      	Add condvars. Remove static mutext from API.
      	Implement static mutexes by initializing them from threads_init.
      
      	* glib/dbus-gthread.c:
      	* qt/dbus-qthread.cpp:
      	Update with the thread api changes.
      
      
      	* dbus/dbus-list.c:
      	* dbus/dbus-list.h:
      	Turn StaticMutex into normal mutex + init function.
      	Export new functions _dbus_list_alloc_link, _dbus_list_free_link,
      	_dbus_list_append_link, _dbus_list_prepend_link
      
      
      	* dbus/dbus-sysdeps.c:
      	* dbus/dbus-sysdeps.h:
      	New type dbus_atomic_t, and new functions _dbus_atomic_inc,
      	_dbus_atomic_dec. Only slow fallback implementation at the moment.
      
      	* dbus/dbus-protocol.h:
      	Add DBUS_MESSAGE_LOCAL_DISCONNECT define
      
      	* dbus/dbus-message.c:
      	Make ref/unref atomic.
      	Fix some docs.
      
      	* dbus/dbus-connection-internal.h:
      	* dbus/dbus-connection.c:
      	* dbus/dbus-connection.h:
      	Make threadsafe.
      	Change _peek to _borrow,_return & _steal_borrowed.
      	Change disconnect callback to event.
      	Make dbus_connection_dispatch_messages reentrant.
      
      	* dbus/dbus-transport.c:
      	Don't ref the connection on calls to the transport
      	implementation.
      
      	* dbus/dbus-message-handler.c:
      	Make threadsafe.
      
      	* glib/dbus-gmain.c:
      	Don't use peek_message anymore
      
      	* test/Makefile.am:
      	* test/debug-thread.c:
      	* test/debug-thread.h:
      	Simple thread implementation that asserts() on deadlocks in
      	single-threaded code.
      
      	* test/bus-test.c:
      	(main) Call debug_threads_init.
      
      	* test/watch.c:
      	Use disconnect message instead of disconnect callback.
      
      	* bus/connection.c:
      	* bus/connection.h:
      	Don't call dbus_connection_set_disconnect_function. Instead export
      	bus_connection_disconnect.
      
      	* bus/dispatch.c:
      	Call bus_connection_disconnect when we get a disconnected message.
      fe401894
  7. 27 Jan, 2003 1 commit
    • Anders Carlsson's avatar
      2003-01-27 Anders Carlsson <andersca@codefactory.se> · ee1133de
      Anders Carlsson authored
      	* bus/dispatch.c: (bus_dispatch_message_handler):
      	Dispatch messages sent to services.
      
      	* bus/driver.c: (bus_driver_send_service_deleted),
      	(bus_driver_send_service_created), (bus_driver_send_service_lost),
      	(bus_driver_send_service_acquired):
      	Add helper functions for sending service related messages.
      
      	(bus_driver_send_welcome_message):
      	Send HELLO_REPLY instead of WELCOME.
      
      	(bus_driver_handle_list_services):
      	Send LIST_SERVICES_REPLY instead of SERVICES.
      
      	(bus_driver_handle_own_service),
      	(bus_driver_handle_service_exists):
      	New message handlers.
      
      	(bus_driver_handle_message):
      	Invoke new message handlers.
      
      	(bus_driver_remove_connection):
      	Don't remove any services here since that's done automatically
      	by bus_service_remove_owner now.
      
      	* bus/driver.h:
      	New function signatures.
      
      	* bus/services.c: (bus_service_add_owner):
      	Send ServiceAcquired message if we're the only primary owner.
      
      	(bus_service_remove_owner):
      	Send ServiceAcquired/ServiceLost messages.
      
      	(bus_service_set_prohibit_replacement),
      	(bus_service_get_prohibit_replacement):
      	Functions for setting prohibit replacement.
      
      	(bus_service_has_owner):
      	New function that checks if a connection is in the owner queue of
      	a certain service.
      
      	* bus/services.h:
      	Add new function signatures.
      
      	* dbus/dbus-list.c: (_dbus_list_test):
      	Add tests for _dbus_list_remove_last and traversing the list backwards.
      
      	* dbus/dbus-list.h:
      	Fix a typo in _dbus_list_get_prev_link, if we're at the first element we can't
      	go any further, so return NULL then.
      
      	* dbus/dbus-protocol.h:
      	Add new messages, service flags and service replies.
      ee1133de
  8. 25 Jan, 2003 2 commits
  9. 24 Dec, 2002 1 commit
    • Havoc Pennington's avatar
      2002-12-24 Havoc Pennington <hp@pobox.com> · 17fbe2b7
      Havoc Pennington authored
      	* glib/dbus-gthread.c: fix include
      
      	* glib/dbus-glib.h: rename DBusMessageHandler for now.
      	I think glib API needs to change, though, as you don't
      	want to use DBusMessageFunction, you want to use the
      	DBusMessageHandler object. Probably
      	dbus_connection_open_with_g_main_loop()
      	and dbus_connection_setup_g_main_loop() or something like that
      	(but think of better names...) that just create a connection
      	that has watch/timeout functions etc. already set up.
      
      	* dbus/dbus-connection.c
      	(dbus_connection_send_message_with_reply): new function just to
      	show how the message handler helps us deal with replies.
      
      	* dbus/dbus-list.c (_dbus_list_remove_last): new function
      
      	* dbus/dbus-string.c (_dbus_string_test): free a string that
      	wasn't
      
      	* dbus/dbus-hash.c: use memory pools for the hash entries
      	(rebuild_table): be more paranoid about overflow, and
      	shrink table when we can
      	(_dbus_hash_test): reduce number of sprintfs and write
      	valid C89. Add tests for case where we grow and then
      	shrink the hash table.
      
      	* dbus/dbus-mempool.h, dbus/dbus-mempool.c: memory pools
      
      	* dbus/dbus-connection.c (dbus_connection_register_handler)
      	(dbus_connection_unregister_handler): new functions
      
      	* dbus/dbus-message.c (dbus_message_get_name): new
      
      	* dbus/dbus-list.c: fix docs typo
      
      	* dbus/dbus-message-handler.h, dbus/dbus-message-handler.c:
      	an object representing a handler for messages.
      17fbe2b7
  10. 25 Nov, 2002 1 commit
    • Havoc Pennington's avatar
      2002-11-24 Havoc Pennington <hp@pobox.com> · 041b0767
      Havoc Pennington authored
              * test/echo-client.c, test/echo-server.c: cheesy test
      	clients.
      
      	* configure.in (AC_CHECK_FUNCS): check for writev
      
      	* dbus/dbus-message.c (_dbus_message_get_network_data): new
      	function
      
      	* dbus/dbus-list.c (_dbus_list_foreach): new function
      
      	* dbus/dbus-internals.c (_dbus_verbose): new function
      
      	* dbus/dbus-server.c, dbus/dbus-server.h: public object
      	representing a server that listens for connections.
      
      	* dbus/.cvsignore: create
      
      	* dbus/dbus-errors.h, dbus/dbus-errors.c:
      	public API for reporting errors
      
      	* dbus/dbus-connection.h, dbus/dbus-connection.c:
      	public object representing a connection that
      	sends/receives messages. (Same object used for
      	both client and server.)
      
      	* dbus/dbus-transport.h, dbus/dbus-transport.c:
      	Basic abstraction for different kinds of stream
      	that we might read/write messages from.
      041b0767
  11. 23 Nov, 2002 1 commit
    • Havoc Pennington's avatar
      2002-11-23 Havoc Pennington <hp@pobox.com> · 576cdb6e
      Havoc Pennington authored
      	* dbus/dbus-internals.h (_DBUS_INT_MAX): add _DBUS_INT_MIN
      	_DBUS_INT_MAX
      
      	* dbus/dbus-test.c (main): add list test, and include
      	dbus-test.h as intended
      
      	* dbus/dbus-hash.c (_dbus_hash_table_remove_string)
      	(_dbus_hash_table_remove_int): return value indicates
      	whether the entry existed to remove
      
      	* dbus/dbus-list.c: add linked list utility class,
      	with docs and tests
      
      	* dbus/dbus-hash.c: add TODO item about shrinking the hash bucket
      	array sometimes.
      576cdb6e