#include "dbus-auth.h"
#include "dbus-address.h"
#include "dbus-credentials.h"
-#include "dbus-message-private.h"
-#include "dbus-marshal-header.h"
-#ifdef DBUS_BUILD_TESTS
+#include "dbus-mainloop.h"
+#include "dbus-message.h"
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
#include "dbus-server-debug-pipe.h"
#endif
_dbus_verbose ("Unix FD counter value is now %d\n",
(int) _dbus_counter_get_unix_fd_value (counter));
#endif
-
+
/* disable or re-enable the read watch for the transport if
* required.
*/
if (transport->vtable->live_messages_changed)
- (* transport->vtable->live_messages_changed) (transport);
+ {
+ _dbus_connection_lock (transport->connection);
+ (* transport->vtable->live_messages_changed) (transport);
+ _dbus_connection_unlock (transport->connection);
+ }
_dbus_transport_unref (transport);
}
int len, i;
_dbus_assert (address != NULL);
- _dbus_assert (*address != '\0');
if (!dbus_parse_address (address, &entries, &len, error))
return NULL; /* not a valid address */
{ _dbus_transport_open_socket },
{ _dbus_transport_open_platform_specific },
{ _dbus_transport_open_autolaunch }
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
, { _dbus_transport_open_debug_pipe }
#endif
};
_dbus_connection_unref_unlocked (transport->connection);
return FALSE;
}
-
- if (transport->expected_guid == NULL)
- {
- transport->expected_guid = _dbus_strdup (server_guid);
-
- if (transport->expected_guid == NULL)
- {
- _dbus_verbose ("No memory to complete auth\n");
- return FALSE;
- }
- }
}
/* If we're the server, see if we want to allow this identity to proceed.
{
if (transport->is_server)
return NULL;
+ else if (transport->authenticated)
+ return _dbus_auth_get_guid_from_server (transport->auth);
else
return transport->expected_guid;
}
}
else
{
+ /* We didn't call the notify function when we added the counter, so
+ * catch up now. Since we have the connection's lock, it's desirable
+ * that we bypass the notify function and call this virtual method
+ * directly. */
+ if (transport->vtable->live_messages_changed)
+ (* transport->vtable->live_messages_changed) (transport);
+
/* pass ownership of link and message ref to connection */
_dbus_connection_queue_received_message_link (transport->connection,
link);
if (_dbus_credentials_include (auth_identity,
DBUS_CREDENTIAL_UNIX_PROCESS_ID))
{
- *pid = _dbus_credentials_get_unix_pid (auth_identity);
+ *pid = _dbus_credentials_get_pid (auth_identity);
return TRUE;
}
else
transport->allow_anonymous = value != FALSE;
}
+#ifdef DBUS_ENABLE_STATS
+void
+_dbus_transport_get_stats (DBusTransport *transport,
+ dbus_uint32_t *queue_bytes,
+ dbus_uint32_t *queue_fds,
+ dbus_uint32_t *peak_queue_bytes,
+ dbus_uint32_t *peak_queue_fds)
+{
+ if (queue_bytes != NULL)
+ *queue_bytes = _dbus_counter_get_size_value (transport->live_messages);
+
+ if (queue_fds != NULL)
+ *queue_fds = _dbus_counter_get_unix_fd_value (transport->live_messages);
+
+ if (peak_queue_bytes != NULL)
+ *peak_queue_bytes = _dbus_counter_get_peak_size_value (transport->live_messages);
+
+ if (peak_queue_fds != NULL)
+ *peak_queue_fds = _dbus_counter_get_peak_unix_fd_value (transport->live_messages);
+}
+#endif /* DBUS_ENABLE_STATS */
+
/** @} */