summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--dbus/dbus-connection.c10
-rw-r--r--dbus/dbus-message-internal.h1
-rw-r--r--dbus/dbus-message.c32
4 files changed, 28 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 92cfe5e2..5d06c816 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2003-01-24 Havoc Pennington <hp@pobox.com>
* dbus/dbus-list.c (alloc_link): put a thread lock on the global
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