X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbus%2Fdbus-transport-socket.c;h=bd19f9b558d2b29a83b61349b8aab8517a63b2fd;hb=a0be921da79a78e2c0484d99aac9002a1de1d0cf;hp=849a1077c2900b296c9d96c9274e21d493214cf9;hpb=dbecdeabb20e0ce11121819c63373f0afba57c58;p=platform%2Fupstream%2Fdbus.git diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index 849a107..bd19f9b 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -73,7 +73,7 @@ free_watches (DBusTransport *transport) { DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport; - _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME); + _dbus_verbose ("start\n"); if (socket_transport->read_watch) { @@ -95,7 +95,7 @@ free_watches (DBusTransport *transport) socket_transport->write_watch = NULL; } - _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME); + _dbus_verbose ("end\n"); } static void @@ -103,7 +103,7 @@ socket_finalize (DBusTransport *transport) { DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport; - _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME); + _dbus_verbose ("\n"); free_watches (transport); @@ -135,7 +135,7 @@ check_write_watch (DBusTransport *transport) _dbus_transport_ref (transport); - if (_dbus_transport_get_is_authenticated (transport)) + if (_dbus_transport_try_to_authenticate (transport)) needed = _dbus_connection_has_messages_to_send_unlocked (transport->connection); else { @@ -177,8 +177,7 @@ check_read_watch (DBusTransport *transport) DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport; dbus_bool_t need_read_watch; - _dbus_verbose ("%s: fd = %d\n", - _DBUS_FUNCTION_NAME, socket_transport->fd); + _dbus_verbose ("fd = %d\n",socket_transport->fd); if (transport->connection == NULL) return; @@ -191,7 +190,7 @@ check_read_watch (DBusTransport *transport) _dbus_transport_ref (transport); - if (_dbus_transport_get_is_authenticated (transport)) + if (_dbus_transport_try_to_authenticate (transport)) need_read_watch = (_dbus_counter_get_size_value (transport->live_messages) < transport->max_live_messages_size) && (_dbus_counter_get_unix_fd_value (transport->live_messages) < transport->max_live_messages_unix_fds); @@ -405,7 +404,7 @@ do_authentication (DBusTransport *transport, oom = FALSE; - orig_auth_state = _dbus_transport_get_is_authenticated (transport); + orig_auth_state = _dbus_transport_try_to_authenticate (transport); /* This is essential to avoid the check_write_watch() at the end, * we don't want to add a write watch in do_iteration before @@ -420,7 +419,7 @@ do_authentication (DBusTransport *transport, _dbus_transport_ref (transport); - while (!_dbus_transport_get_is_authenticated (transport) && + while (!_dbus_transport_try_to_authenticate (transport) && _dbus_transport_get_is_connected (transport)) { if (!exchange_credentials (transport, do_reading, do_writing)) @@ -478,7 +477,7 @@ do_authentication (DBusTransport *transport, out: if (auth_completed) - *auth_completed = (orig_auth_state != _dbus_transport_get_is_authenticated (transport)); + *auth_completed = (orig_auth_state != _dbus_transport_try_to_authenticate (transport)); check_read_watch (transport); check_write_watch (transport); @@ -499,7 +498,7 @@ do_writing (DBusTransport *transport) dbus_bool_t oom; /* No messages without authentication! */ - if (!_dbus_transport_get_is_authenticated (transport)) + if (!_dbus_transport_try_to_authenticate (transport)) { _dbus_verbose ("Not authenticated, not writing anything\n"); return TRUE; @@ -678,8 +677,8 @@ do_writing (DBusTransport *transport) _dbus_string_set_length (&socket_transport->encoded_outgoing, 0); _dbus_string_compact (&socket_transport->encoded_outgoing, 2048); - _dbus_connection_message_sent (transport->connection, - message); + _dbus_connection_message_sent_unlocked (transport->connection, + message); } } } @@ -701,11 +700,10 @@ do_reading (DBusTransport *transport) int total; dbus_bool_t oom; - _dbus_verbose ("%s: fd = %d\n", _DBUS_FUNCTION_NAME, - socket_transport->fd); + _dbus_verbose ("fd = %d\n",socket_transport->fd); /* No messages without authentication! */ - if (!_dbus_transport_get_is_authenticated (transport)) + if (!_dbus_transport_try_to_authenticate (transport)) return TRUE; oom = FALSE; @@ -817,7 +815,7 @@ do_reading (DBusTransport *transport) buffer, bytes_read < 0 ? 0 : bytes_read); } - + if (bytes_read < 0) { /* EINTR already handled for us */ @@ -984,7 +982,7 @@ socket_disconnect (DBusTransport *transport) { DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport; - _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME); + _dbus_verbose ("\n"); free_watches (transport); @@ -1057,7 +1055,7 @@ socket_do_iteration (DBusTransport *transport, poll_fd.fd = socket_transport->fd; poll_fd.events = 0; - if (_dbus_transport_get_is_authenticated (transport)) + if (_dbus_transport_try_to_authenticate (transport)) { /* This is kind of a hack; if we have stuff to write, then try * to avoid the poll. This is probably about a 5% speedup on an @@ -1119,7 +1117,7 @@ socket_do_iteration (DBusTransport *transport, */ if (flags & DBUS_ITERATION_BLOCK) { - _dbus_verbose ("unlock %s pre poll\n", _DBUS_FUNCTION_NAME); + _dbus_verbose ("unlock pre poll\n"); _dbus_connection_unlock (transport->connection); } @@ -1131,7 +1129,7 @@ socket_do_iteration (DBusTransport *transport, if (flags & DBUS_ITERATION_BLOCK) { - _dbus_verbose ("lock %s post poll\n", _DBUS_FUNCTION_NAME); + _dbus_verbose ("lock post poll\n"); _dbus_connection_lock (transport->connection); } @@ -1280,8 +1278,10 @@ _dbus_transport_new_for_socket (int fd, return (DBusTransport*) socket_transport; failed_4: + _dbus_watch_invalidate (socket_transport->read_watch); _dbus_watch_unref (socket_transport->read_watch); failed_3: + _dbus_watch_invalidate (socket_transport->write_watch); _dbus_watch_unref (socket_transport->write_watch); failed_2: _dbus_string_free (&socket_transport->encoded_incoming); @@ -1299,7 +1299,7 @@ _dbus_transport_new_for_socket (int fd, * @param host the host to connect to * @param port the port to connect to * @param family the address family to connect to - * @param path to nonce file + * @param noncefile path to nonce file * @param error location to store reason for failure. * @returns a new transport, or #NULL on failure. */ @@ -1337,12 +1337,12 @@ _dbus_transport_new_for_tcp_socket (const char *host, goto error; if (family != NULL && - (!_dbus_string_append (&address, "family=") || + (!_dbus_string_append (&address, ",family=") || !_dbus_string_append (&address, family))) goto error; if (noncefile != NULL && - (!_dbus_string_append (&address, "noncefile=") || + (!_dbus_string_append (&address, ",noncefile=") || !_dbus_string_append (&address, noncefile))) goto error;