Commit graph

3034 commits

Author SHA1 Message Date
Simon McVittie
af13ae7e43 _dbus_connect_tcp_socket_with_nonce: don't create an extra fd (which is then leaked)
This block should have been deleted in 2007, when IPv6 support was added:
previously, the fd allocated at the beginning of the function was used
for connect(), but for IPv6 support, the socket() call has to be inside
the loop over getaddrinfo() results so its address family can be changed.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37258
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-07-18 15:11:47 +01:00
Simon McVittie
e9197996fe Merge branch 'dbus-1.4' 2011-07-14 16:49:02 +01:00
Simon McVittie
c6c1874179 DBusServer: exclusively use atomic operations on the refcount
Same reasoning as for fd.o #38005, commit 50732523a7.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38005
Bug-NB: NB#263436
2011-07-14 16:37:46 +01:00
Simon McVittie
6d65b409f9 DBusPendingCall: exclusively use atomic operations on the refcount
Same reasoning as for fd.o #38005, commit 50732523a7.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38005
Bug-NB: NB#263436
2011-07-14 16:37:05 +01:00
Cosimo Alfarano
b86e967d63 Add testsuite for eavesdrop=true DBusMatchRule
[with some typos fixed during commit -smcv]

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37890
Bug-NB: NB#269748
2011-07-14 16:25:20 +01:00
Cosimo Alfarano
f997b0ac48 Fix dbus-monitor using eavesdrop=true when no filters are passed
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-07-12 18:36:40 +01:00
Simon McVittie
cb843a5643 DBusHeader: only store byte-order in the fixed-length header
Reviewed-by: Thiago Macieira <thiago@kde.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38287
2011-07-11 17:55:13 +01:00
Simon McVittie
47fb9da6ad DBusMessage: don't redundantly store byte order, ask the DBusHeader
Reviewed-by: Thiago Macieira <thiago@kde.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38287
2011-07-11 17:54:36 +01:00
Cosimo Alfarano
56b9629d69 Add "eavesdrop=true" as constant match rule for dbus-monitor
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37890
Bug-NB: NB#269748
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-07-11 17:03:54 +01:00
Cosimo Alfarano
a940e7b1d1 Do not allow eavedropping unless rule owner explicitely declare it
Adds "eavesdrop=true" as a match rule, meaning that the owner
intend to eavedrop.
Otherwise the owner will receive only broadcasted messages and the ones
meant to be delivered to it.

[plus a typo fix in an error message -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37890
Bug-NB: NB#269748
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-07-11 17:03:20 +01:00
Simon McVittie
0ecd0a02b9 Merge remote-tracking branch 'origin/dbus-1.4' 2011-07-11 13:23:38 +01:00
Jiří Klimeš
ea8aabf0be DBusConnection: simplify registering object paths code
Introduce static generic _dbus_connection_register_object_path()
function to remove duplicate code for registration object paths.
Having *four* almost the same functions is error-prone and hard
to follow as well.

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38874
2011-07-11 13:23:23 +01:00
Simon McVittie
fa1a85e121 Cope with platforms whose vsnprintf violates both POSIX and C99 - part 1 2011-07-08 11:00:12 +02:00
Simon McVittie
7b63fe3cfa In Windows _dbus_printf_string_upper_bound, don't crash on malloc failure 2011-07-08 11:00:02 +02:00
Ralf Habacker
110e06a78c Added DBUS_ENABLE_STATS option to cmake buildsystem to keep in sync with autotools. 2011-07-08 10:55:46 +02:00
Ralf Habacker
0161eb8c34 Visual Studio Professional uses a different ide starter - pointed out by Romain Pokrzywka 2011-07-08 10:55:16 +02:00
Ralf Habacker
836b84a05a Collected cmake doc into README.cmake. 2011-07-08 10:55:03 +02:00
Ralf Habacker
ba9178b153 Visual Studio Professional uses a different ide starter - pointed out by Romain Pokrzywka 2011-07-08 10:53:20 +02:00
Ralf Habacker
1fd58d6db4 win32 fix: Keep server autolaunch mutex settings according to client detection algorithmus. 2011-07-05 19:45:23 +02:00
Ralf Habacker
4ee7b07b20 Fixed cmake buildsystem - option command only supports boolean values 2011-07-04 23:47:45 +02:00
Simon McVittie
b32aaa8a57 Cope with platforms whose vsnprintf violates both POSIX and C99 - part 1 2011-07-03 06:47:39 +02:00
Simon McVittie
e7bd2bb848 In Windows _dbus_printf_string_upper_bound, don't crash on malloc failure 2011-07-03 06:36:07 +02:00
Ralf Habacker
84b03cae58 Limit batch file creating to windows 2011-07-03 01:39:09 +02:00
Ralf Habacker
b77885c1db Fixed cmake buildsystem on unix - option command only supports boolean values 2011-07-03 01:36:48 +02:00
Ralf Habacker
6321a98492 Collected cmake doc into README.cmake. 2011-07-02 21:02:46 +02:00
Ralf Habacker
a7f98d8819 Added DBUS_ENABLE_STATS option to cmake buildsystem to keep in sync with autotools. 2011-07-02 00:53:23 +02:00
Ralf Habacker
e2f94ea14f win32 fix: Keep server autolaunch mutex settings according to client detection algorithmus. 2011-07-01 16:28:19 +02:00
Simon McVittie
636a9a29f8 Merge branch 'dbus-1.4' 2011-07-01 14:54:42 +01:00
Jiří Klimeš
0dcb911251 DBusConnection: use DBUS_ERROR_OBJECT_PATH_IN_USE instead of DBUS_ERROR_ADDRESS_IN_USE
While registering an object path the possible error is
DBUS_ERROR_OBJECT_PATH_IN_USE, not DBUS_ERROR_ADDRESS_IN_USE (the error
is set by _dbus_object_tree_register()).

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38874
2011-07-01 14:48:48 +01:00
Simon McVittie
30f116fd2d Include size of link cache in per-connection statistics
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:56 +01:00
Simon McVittie
cf08dce402 Also record peak values for queued bytes/fds in connection stats
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:56 +01:00
Simon McVittie
f69ac31dd9 Add an initial round of stats to the Stats interface
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:56 +01:00
Simon McVittie
fce1f6b55f DBusConnection, DBusTransport: add queue statistics
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:46 +01:00
Simon McVittie
8a3e7581e7 BusConnections: add usage stats for well-known names, match rules
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:06 +01:00
Simon McVittie
2351f57081 DBusList: add usage stats
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:02 +01:00
Simon McVittie
82bc508785 DBusMemPool: add usage stats
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:00:57 +01:00
Simon McVittie
206fff7ee6 Add a stub .Debug.Stats interface if --enable-stats
There are no actual statistics yet, just a count of how many times the
method has been called, and (for the per-connection stats) the unique name.

Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:00:49 +01:00
Simon McVittie
bc212b72b2 configure.ac: add --enable-stats
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:00:43 +01:00
Simon McVittie
85e9a28303 match_rule_to_string: don't reinvent dbus_message_type_to_string
We don't allow match rules with unknown message types, so losing the
"type='%d'" case isn't a great loss.

Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:00:13 +01:00
Simon McVittie
16b9600964 Remove maximum length field from DBusString
The source code says it's "a historical artifact from a feature that
turned out to be dumb". Respond accordingly!

This reduces sizeof (DBusString) by 20% on ILP32 architectures, which
can't hurt. (No reduction on LP64 architectures that align pointers
naturally, unfortunately.)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38570
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-22 19:15:05 +01:00
Simon McVittie
e3b9a0597c Remove unused _dbus_string_copy_data_len, _dbus_string_steal_data_len
They're only compiled when building tests.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38570
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-22 19:15:01 +01:00
Simon McVittie
c8a7417c73 Split DBUS_GENERIC_STRING_PREAMBLE into sensible lines
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38570
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-22 19:14:46 +01:00
Ralf Habacker
736445ee44 CMake fix: Do not use FORCE in variables which should be changeable by the user. 2011-06-20 09:29:12 +02:00
Ralf Habacker
aba867f242 fixed cmake error: doc says CACHE needs type *and* doc string 2011-06-14 18:45:46 +02:00
Simon McVittie
5e7824729d NEWS 2011-06-13 16:54:00 +01:00
Simon McVittie
a246e250d0 DBusLoop: store watches in a hash table keyed by fd
This means we don't need to build up the watches_for_fds array, because
it's quick to find the watches based on the fd.

This also fixes fd.o #23194, because we only put each fd in the
array of DBusPollFD once, with the union of all its watches' flags; we
can no longer get more entries in the array than our number of file
descriptors, which is capped at our RLIMIT_NOFILE, so we can't get
EINVAL from poll(2).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=23194
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:37:25 +01:00
Simon McVittie
9aa45eef4d DBusLoop: fold Callback into TimeoutCallback
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:32:49 +01:00
Simon McVittie
6600f17a7e Drop WatchCallback entirely, just use a list of DBusWatch in the main loop
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:30:27 +01:00
Simon McVittie
5bd6056169 DBusLoop: inline add_callback, remove_callback into their callers
The watch and timeout code paths will diverge completely when we change
WatchCallback * to just be a DBusWatch *, removing the benefit of having
common code.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:28:06 +01:00
Simon McVittie
0292b1a56d DBusLoop: move OOM flag in watches inside the DBusWatch
This will eventually let us maintain a DBusPollFD[] of just the active
watches, between several iterations. The more immediate benefit is that
WatchCallback can go away, because it only contains a refcount, a
now-useless type, and a watch that already has its own refcount.

This doesn't take any more memory for DBusWatch when not using DBusLoop
(e.g. in client/service code or bindings), because we're just using more
bits in an existing bitfield.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:25:33 +01:00