diff options
author | Anders Carlsson <andersca@codefactory.se> | 2003-01-25 09:37:49 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@codefactory.se> | 2003-01-25 09:37:49 +0000 |
commit | a2a681582929ada667de5d05d5168f8a1f313800 (patch) | |
tree | 81a49bb51769b86def6b844403db4c24c8750490 /dbus | |
parent | a1a53c32422230fb76e8e3bca67c877dd2857563 (diff) |
2003-01-25 Anders Carlsson <andersca@codefactory.se>
* dbus/dbus-connection.c: (dbus_connection_send_message):
* dbus/dbus-message-internal.h:
* dbus/dbus-message.c: (_dbus_message_get_client_serial),
(dbus_message_write_header):
Remove _dbus_messag_unlock and don't set the client serial on a
message if one already exists.
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-connection.c | 10 | ||||
-rw-r--r-- | dbus/dbus-message-internal.h | 1 | ||||
-rw-r--r-- | dbus/dbus-message.c | 32 |
3 files changed, 19 insertions, 24 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index 9fcabb9c..f5e3342f 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -644,12 +644,12 @@ dbus_connection_send_message (DBusConnection *connection, _dbus_verbose ("Message %p added to outgoing queue, %d pending to send\n", message, connection->n_outgoing); - /* Unlock the message, resetting its header. */ - _dbus_message_unlock (message); + if (_dbus_message_get_client_serial (message) == -1) + { + serial = _dbus_connection_get_next_client_serial (connection); + _dbus_message_set_client_serial (message, serial); + } - serial = _dbus_connection_get_next_client_serial (connection); - _dbus_message_set_client_serial (message, serial); - if (client_serial) *client_serial = serial; diff --git a/dbus/dbus-message-internal.h b/dbus/dbus-message-internal.h index 8059ecdc..00adb40b 100644 --- a/dbus/dbus-message-internal.h +++ b/dbus/dbus-message-internal.h @@ -38,6 +38,7 @@ void _dbus_message_lock (DBusMessage *message); void _dbus_message_unlock (DBusMessage *message); void _dbus_message_set_client_serial (DBusMessage *message, dbus_int32_t client_serial); +dbus_int32_t _dbus_message_get_client_serial (DBusMessage *message); dbus_int32_t _dbus_message_get_reply_serial (DBusMessage *message); void _dbus_message_add_size_counter (DBusMessage *message, DBusCounter *counter); diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index d5b1fb86..a42b797b 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -125,6 +125,19 @@ _dbus_message_set_client_serial (DBusMessage *message, } /** + * Returns the client serial of a message or + * -1 if none has been specified. + * + * @param message the message + * @returns the client serial + */ +dbus_int32_t +_dbus_message_get_client_serial (DBusMessage *message) +{ + return message->client_serial; +} + +/** * Returns the serial that the message is * a reply to. * @@ -239,25 +252,6 @@ dbus_message_write_header (DBusMessage *message) } /** - * Unlocks a message so that it can be re-sent to another client. - * - * @see _dbus_message_lock - * @param message the message to unlock. - */ -void -_dbus_message_unlock (DBusMessage *message) -{ - if (!message->locked) - return; - - /* Restore header */ - _dbus_string_set_length (&message->header, 0); - - message->client_serial = -1; - message->locked = FALSE; -} - -/** * Locks a message. Allows checking that applications don't keep a * reference to a message in the outgoing queue and change it * underneath us. Messages are locked when they enter the outgoing |