1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-transport-unix.c UNIX socket subclasses of DBusTransport
4 * Copyright (C) 2002, 2003 Red Hat Inc.
6 * Licensed under the Academic Free License version 1.2
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "dbus-internals.h"
25 #include "dbus-connection-internal.h"
26 #include "dbus-transport-unix.h"
27 #include "dbus-transport-protected.h"
28 #include "dbus-watch.h"
29 #include <sys/types.h>
35 * @defgroup DBusTransportUnix DBusTransport implementations for UNIX
36 * @ingroup DBusInternals
37 * @brief Implementation details of DBusTransport on UNIX
43 * Opaque object representing a Unix file descriptor transport.
45 typedef struct DBusTransportUnix DBusTransportUnix;
48 * Implementation details of DBusTransportUnix. All members are private.
50 struct DBusTransportUnix
52 DBusTransport base; /**< Parent instance */
53 int fd; /**< File descriptor. */
54 DBusWatch *read_watch; /**< Watch for readability. */
55 DBusWatch *write_watch; /**< Watch for writability. */
57 int max_bytes_read_per_iteration; /**< To avoid blocking too long. */
58 int max_bytes_written_per_iteration; /**< To avoid blocking too long. */
60 int message_bytes_written; /**< Number of bytes of current
61 * outgoing message that have
64 DBusString encoded_outgoing; /**< Encoded version of current
67 DBusString encoded_incoming; /**< Encoded version of current
73 free_watches (DBusTransport *transport)
75 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
77 if (unix_transport->read_watch)
79 if (transport->connection)
80 _dbus_connection_remove_watch (transport->connection,
81 unix_transport->read_watch);
82 _dbus_watch_invalidate (unix_transport->read_watch);
83 _dbus_watch_unref (unix_transport->read_watch);
84 unix_transport->read_watch = NULL;
87 if (unix_transport->write_watch)
89 if (transport->connection)
90 _dbus_connection_remove_watch (transport->connection,
91 unix_transport->write_watch);
92 _dbus_watch_invalidate (unix_transport->write_watch);
93 _dbus_watch_unref (unix_transport->write_watch);
94 unix_transport->write_watch = NULL;
99 unix_finalize (DBusTransport *transport)
101 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
103 free_watches (transport);
105 _dbus_string_free (&unix_transport->encoded_outgoing);
106 _dbus_string_free (&unix_transport->encoded_incoming);
108 _dbus_transport_finalize_base (transport);
110 _dbus_assert (unix_transport->read_watch == NULL);
111 _dbus_assert (unix_transport->write_watch == NULL);
113 dbus_free (transport);
117 check_write_watch (DBusTransport *transport)
119 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
120 dbus_bool_t need_write_watch;
122 if (transport->connection == NULL)
125 if (transport->disconnected)
127 _dbus_assert (unix_transport->write_watch == NULL);
131 _dbus_transport_ref (transport);
133 if (_dbus_transport_get_is_authenticated (transport))
134 need_write_watch = transport->messages_need_sending;
136 need_write_watch = transport->send_credentials_pending ||
137 _dbus_auth_do_work (transport->auth) == DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND;
139 _dbus_connection_toggle_watch (transport->connection,
140 unix_transport->write_watch,
143 _dbus_transport_unref (transport);
147 check_read_watch (DBusTransport *transport)
149 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
150 dbus_bool_t need_read_watch;
152 if (transport->connection == NULL)
155 if (transport->disconnected)
157 _dbus_assert (unix_transport->read_watch == NULL);
161 _dbus_transport_ref (transport);
163 if (_dbus_transport_get_is_authenticated (transport))
165 _dbus_counter_get_value (transport->live_messages_size) < transport->max_live_messages_size;
167 need_read_watch = transport->receive_credentials_pending ||
168 _dbus_auth_do_work (transport->auth) == DBUS_AUTH_STATE_WAITING_FOR_INPUT;
170 _dbus_connection_toggle_watch (transport->connection,
171 unix_transport->read_watch,
174 _dbus_transport_unref (transport);
178 do_io_error (DBusTransport *transport)
180 _dbus_transport_ref (transport);
181 _dbus_transport_disconnect (transport);
182 _dbus_transport_unref (transport);
185 /* return value is whether we successfully read any new data. */
187 read_data_into_auth (DBusTransport *transport,
190 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
196 _dbus_auth_get_buffer (transport->auth, &buffer);
198 bytes_read = _dbus_read (unix_transport->fd,
199 buffer, unix_transport->max_bytes_read_per_iteration);
201 _dbus_auth_return_buffer (transport->auth, buffer,
202 bytes_read > 0 ? bytes_read : 0);
206 _dbus_verbose (" read %d bytes in auth phase\n", bytes_read);
210 else if (bytes_read < 0)
212 /* EINTR already handled for us */
218 else if (errno == EAGAIN ||
219 errno == EWOULDBLOCK)
220 ; /* do nothing, just return FALSE below */
223 _dbus_verbose ("Error reading from remote app: %s\n",
224 _dbus_strerror (errno));
225 do_io_error (transport);
232 _dbus_assert (bytes_read == 0);
234 _dbus_verbose ("Disconnected from remote app\n");
235 do_io_error (transport);
241 /* Return value is whether we successfully wrote any bytes */
243 write_data_from_auth (DBusTransport *transport)
245 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
247 const DBusString *buffer;
249 if (!_dbus_auth_get_bytes_to_send (transport->auth,
253 bytes_written = _dbus_write (unix_transport->fd,
255 0, _dbus_string_get_length (buffer));
257 if (bytes_written > 0)
259 _dbus_auth_bytes_sent (transport->auth, bytes_written);
262 else if (bytes_written < 0)
264 /* EINTR already handled for us */
266 if (errno == EAGAIN ||
267 errno == EWOULDBLOCK)
271 _dbus_verbose ("Error writing to remote app: %s\n",
272 _dbus_strerror (errno));
273 do_io_error (transport);
281 exchange_credentials (DBusTransport *transport,
282 dbus_bool_t do_reading,
283 dbus_bool_t do_writing)
285 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
287 if (do_writing && transport->send_credentials_pending)
289 if (_dbus_send_credentials_unix_socket (unix_transport->fd,
292 transport->send_credentials_pending = FALSE;
296 _dbus_verbose ("Failed to write credentials\n");
297 do_io_error (transport);
301 if (do_reading && transport->receive_credentials_pending)
303 if (_dbus_read_credentials_unix_socket (unix_transport->fd,
304 &transport->credentials,
307 transport->receive_credentials_pending = FALSE;
311 _dbus_verbose ("Failed to read credentials\n");
312 do_io_error (transport);
316 if (!(transport->send_credentials_pending ||
317 transport->receive_credentials_pending))
319 _dbus_auth_set_credentials (transport->auth,
320 &transport->credentials);
325 do_authentication (DBusTransport *transport,
326 dbus_bool_t do_reading,
327 dbus_bool_t do_writing)
331 _dbus_transport_ref (transport);
335 while (!_dbus_transport_get_is_authenticated (transport) &&
336 _dbus_transport_get_is_connected (transport))
338 exchange_credentials (transport, do_reading, do_writing);
340 if (transport->send_credentials_pending ||
341 transport->receive_credentials_pending)
343 _dbus_verbose ("send_credentials_pending = %d receive_credentials_pending = %d\n",
344 transport->send_credentials_pending,
345 transport->receive_credentials_pending);
349 switch (_dbus_auth_do_work (transport->auth))
351 case DBUS_AUTH_STATE_WAITING_FOR_INPUT:
352 _dbus_verbose (" auth state: waiting for input\n");
353 if (!do_reading || !read_data_into_auth (transport, &oom))
357 case DBUS_AUTH_STATE_WAITING_FOR_MEMORY:
358 _dbus_verbose (" auth state: waiting for memory\n");
363 case DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND:
364 _dbus_verbose (" auth state: bytes to send\n");
365 if (!do_writing || !write_data_from_auth (transport))
369 case DBUS_AUTH_STATE_NEED_DISCONNECT:
370 _dbus_verbose (" auth state: need to disconnect\n");
371 do_io_error (transport);
374 case DBUS_AUTH_STATE_AUTHENTICATED_WITH_UNUSED_BYTES:
375 _dbus_verbose (" auth state: auth with unused bytes\n");
376 /* We'll recover the unused bytes in dbus-transport.c */
380 case DBUS_AUTH_STATE_AUTHENTICATED:
381 _dbus_verbose (" auth state: authenticated\n");
387 check_read_watch (transport);
388 check_write_watch (transport);
389 _dbus_transport_unref (transport);
397 /* returns false on oom */
399 do_writing (DBusTransport *transport)
402 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
405 /* No messages without authentication! */
406 if (!_dbus_transport_get_is_authenticated (transport))
409 if (transport->disconnected)
415 while (!transport->disconnected &&
416 _dbus_connection_have_messages_to_send (transport->connection))
419 DBusMessage *message;
420 const DBusString *header;
421 const DBusString *body;
422 int header_len, body_len;
423 int total_bytes_to_write;
425 if (total > unix_transport->max_bytes_written_per_iteration)
427 _dbus_verbose ("%d bytes exceeds %d bytes written per iteration, returning\n",
428 total, unix_transport->max_bytes_written_per_iteration);
432 if (!dbus_watch_get_enabled (unix_transport->write_watch))
434 _dbus_verbose ("write watch disabled, not writing more stuff\n");
438 message = _dbus_connection_get_message_to_send (transport->connection);
439 _dbus_assert (message != NULL);
440 _dbus_message_lock (message);
443 _dbus_verbose ("writing message %p\n", message);
446 _dbus_message_get_network_data (message,
449 header_len = _dbus_string_get_length (header);
450 body_len = _dbus_string_get_length (body);
452 if (_dbus_auth_needs_encoding (transport->auth))
454 if (_dbus_string_get_length (&unix_transport->encoded_outgoing) == 0)
456 if (!_dbus_auth_encode_data (transport->auth,
457 header, &unix_transport->encoded_outgoing))
463 if (!_dbus_auth_encode_data (transport->auth,
464 body, &unix_transport->encoded_outgoing))
466 _dbus_string_set_length (&unix_transport->encoded_outgoing, 0);
472 total_bytes_to_write = _dbus_string_get_length (&unix_transport->encoded_outgoing);
475 _dbus_verbose ("encoded message is %d bytes\n",
476 total_bytes_to_write);
480 _dbus_write (unix_transport->fd,
481 &unix_transport->encoded_outgoing,
482 unix_transport->message_bytes_written,
483 total_bytes_to_write - unix_transport->message_bytes_written);
487 total_bytes_to_write = header_len + body_len;
490 _dbus_verbose ("message is %d bytes\n",
491 total_bytes_to_write);
494 if (unix_transport->message_bytes_written < header_len)
497 _dbus_write_two (unix_transport->fd,
499 unix_transport->message_bytes_written,
500 header_len - unix_transport->message_bytes_written,
507 _dbus_write (unix_transport->fd,
509 (unix_transport->message_bytes_written - header_len),
511 (unix_transport->message_bytes_written - header_len));
515 if (bytes_written < 0)
517 /* EINTR already handled for us */
519 if (errno == EAGAIN ||
520 errno == EWOULDBLOCK)
524 _dbus_verbose ("Error writing to remote app: %s\n",
525 _dbus_strerror (errno));
526 do_io_error (transport);
532 _dbus_verbose (" wrote %d bytes of %d\n", bytes_written,
533 total_bytes_to_write);
535 total += bytes_written;
536 unix_transport->message_bytes_written += bytes_written;
538 _dbus_assert (unix_transport->message_bytes_written <=
539 total_bytes_to_write);
541 if (unix_transport->message_bytes_written == total_bytes_to_write)
543 unix_transport->message_bytes_written = 0;
544 _dbus_string_set_length (&unix_transport->encoded_outgoing, 0);
546 _dbus_connection_message_sent (transport->connection,
559 /* returns false on out-of-memory */
561 do_reading (DBusTransport *transport)
563 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
569 /* No messages without authentication! */
570 if (!_dbus_transport_get_is_authenticated (transport))
579 /* See if we've exceeded max messages and need to disable reading */
580 check_read_watch (transport);
581 if (!dbus_watch_get_enabled (unix_transport->read_watch))
584 if (total > unix_transport->max_bytes_read_per_iteration)
586 _dbus_verbose ("%d bytes exceeds %d bytes read per iteration, returning\n",
587 total, unix_transport->max_bytes_read_per_iteration);
591 if (transport->disconnected)
594 if (_dbus_auth_needs_decoding (transport->auth))
596 if (_dbus_string_get_length (&unix_transport->encoded_incoming) > 0)
597 bytes_read = _dbus_string_get_length (&unix_transport->encoded_incoming);
599 bytes_read = _dbus_read (unix_transport->fd,
600 &unix_transport->encoded_incoming,
601 unix_transport->max_bytes_read_per_iteration);
603 _dbus_assert (_dbus_string_get_length (&unix_transport->encoded_incoming) ==
610 _dbus_message_loader_get_buffer (transport->loader,
613 orig_len = _dbus_string_get_length (buffer);
615 if (!_dbus_auth_decode_data (transport->auth,
616 &unix_transport->encoded_incoming,
619 _dbus_verbose ("Out of memory decoding incoming data\n");
624 _dbus_message_loader_return_buffer (transport->loader,
626 _dbus_string_get_length (buffer) - orig_len);
628 _dbus_string_set_length (&unix_transport->encoded_incoming, 0);
633 _dbus_message_loader_get_buffer (transport->loader,
636 bytes_read = _dbus_read (unix_transport->fd,
637 buffer, unix_transport->max_bytes_read_per_iteration);
639 _dbus_message_loader_return_buffer (transport->loader,
641 bytes_read < 0 ? 0 : bytes_read);
646 /* EINTR already handled for us */
650 _dbus_verbose ("Out of memory in read()/do_reading()\n");
654 else if (errno == EAGAIN ||
655 errno == EWOULDBLOCK)
659 _dbus_verbose ("Error reading from remote app: %s\n",
660 _dbus_strerror (errno));
661 do_io_error (transport);
665 else if (bytes_read == 0)
667 _dbus_verbose ("Disconnected from remote app\n");
668 do_io_error (transport);
673 _dbus_verbose (" read %d bytes\n", bytes_read);
677 if (_dbus_transport_queue_messages (transport) == DBUS_DISPATCH_NEED_MEMORY)
683 /* Try reading more data until we get EAGAIN and return, or
684 * exceed max bytes per iteration. If in blocking mode of
685 * course we'll block instead of returning.
698 unix_handle_watch (DBusTransport *transport,
702 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
704 _dbus_assert (watch == unix_transport->read_watch ||
705 watch == unix_transport->write_watch);
707 if (flags & (DBUS_WATCH_HANGUP | DBUS_WATCH_ERROR))
709 _dbus_transport_disconnect (transport);
713 if (watch == unix_transport->read_watch &&
714 (flags & DBUS_WATCH_READABLE))
717 _dbus_verbose ("handling read watch\n");
719 if (!do_authentication (transport, TRUE, FALSE))
722 if (!do_reading (transport))
725 else if (watch == unix_transport->write_watch &&
726 (flags & DBUS_WATCH_WRITABLE))
729 _dbus_verbose ("handling write watch\n");
731 if (!do_authentication (transport, FALSE, TRUE))
734 if (!do_writing (transport))
742 unix_disconnect (DBusTransport *transport)
744 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
746 free_watches (transport);
748 _dbus_close (unix_transport->fd, NULL);
749 unix_transport->fd = -1;
753 unix_connection_set (DBusTransport *transport)
755 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
757 if (!_dbus_connection_add_watch (transport->connection,
758 unix_transport->write_watch))
761 if (!_dbus_connection_add_watch (transport->connection,
762 unix_transport->read_watch))
764 _dbus_connection_remove_watch (transport->connection,
765 unix_transport->write_watch);
769 check_read_watch (transport);
770 check_write_watch (transport);
776 unix_messages_pending (DBusTransport *transport,
777 int messages_pending)
779 check_write_watch (transport);
782 /* FIXME use _dbus_poll(), not select() */
784 * @todo We need to have a way to wake up the select sleep if
785 * a new iteration request comes in with a flag (read/write) that
786 * we're not currently serving. Otherwise a call that just reads
787 * could block a write call forever (if there are no incoming
791 unix_do_iteration (DBusTransport *transport,
793 int timeout_milliseconds)
795 DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
798 dbus_bool_t do_select;
801 _dbus_verbose (" iteration flags = %s%s timeout = %d read_watch = %p write_watch = %p\n",
802 flags & DBUS_ITERATION_DO_READING ? "read" : "",
803 flags & DBUS_ITERATION_DO_WRITING ? "write" : "",
804 timeout_milliseconds,
805 unix_transport->read_watch,
806 unix_transport->write_watch);
808 /* "again" has to be up here because on EINTR the fd sets become
815 /* the passed in DO_READING/DO_WRITING flags indicate whether to
816 * read/write messages, but regardless of those we may need to block
817 * for reading/writing to do auth. But if we do reading for auth,
818 * we don't want to read any messages yet if not given DO_READING.
820 * Also, if read_watch == NULL or write_watch == NULL, we don't
821 * want to read/write so don't.
825 FD_ZERO (&write_set);
827 if (_dbus_transport_get_is_authenticated (transport))
829 if (unix_transport->read_watch &&
830 (flags & DBUS_ITERATION_DO_READING))
832 FD_SET (unix_transport->fd, &read_set);
836 if (unix_transport->write_watch &&
837 (flags & DBUS_ITERATION_DO_WRITING))
839 FD_SET (unix_transport->fd, &write_set);
845 DBusAuthState auth_state;
847 auth_state = _dbus_auth_do_work (transport->auth);
849 if (transport->receive_credentials_pending ||
850 auth_state == DBUS_AUTH_STATE_WAITING_FOR_INPUT)
852 FD_SET (unix_transport->fd, &read_set);
856 if (transport->send_credentials_pending ||
857 auth_state == DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND)
859 FD_SET (unix_transport->fd, &write_set);
867 struct timeval timeout;
868 dbus_bool_t use_timeout;
871 FD_SET (unix_transport->fd, &err_set);
873 if (flags & DBUS_ITERATION_BLOCK)
875 if (timeout_milliseconds >= 0)
877 timeout.tv_sec = timeout_milliseconds / 1000;
878 timeout.tv_usec = (timeout_milliseconds % 1000) * 1000;
880 /* Always use timeout if one is passed in. */
885 use_timeout = FALSE; /* NULL timeout to block forever */
890 /* 0 timeout to not block */
896 /* For blocking selects we drop the connection lock here
897 * to avoid blocking out connection access during a potentially
898 * indefinite blocking call. The io path is still protected
899 * by the io_path_cond condvar, so we won't reenter this.
901 if (flags & DBUS_ITERATION_BLOCK)
902 _dbus_connection_unlock (transport->connection);
904 select_res = select (unix_transport->fd + 1,
905 &read_set, &write_set, &err_set,
906 use_timeout ? &timeout : NULL);
908 if (flags & DBUS_ITERATION_BLOCK)
909 _dbus_connection_lock (transport->connection);
914 if (FD_ISSET (unix_transport->fd, &err_set))
915 do_io_error (transport);
918 dbus_bool_t need_read = FD_ISSET (unix_transport->fd, &read_set);
919 dbus_bool_t need_write = FD_ISSET (unix_transport->fd, &write_set);
921 _dbus_verbose ("in iteration, need_read=%d need_write=%d\n",
922 need_read, need_write);
923 do_authentication (transport, need_read, need_write);
925 if (need_read && (flags & DBUS_ITERATION_DO_READING))
926 do_reading (transport);
927 if (need_write && (flags & DBUS_ITERATION_DO_WRITING))
928 do_writing (transport);
931 else if (errno == EINTR)
935 _dbus_verbose ("Error from select(): %s\n",
936 _dbus_strerror (errno));
942 unix_live_messages_changed (DBusTransport *transport)
944 /* See if we should look for incoming messages again */
945 check_read_watch (transport);
948 static DBusTransportVTable unix_vtable = {
953 unix_messages_pending,
955 unix_live_messages_changed
959 * Creates a new transport for the given file descriptor. The file
960 * descriptor must be nonblocking (use _dbus_set_fd_nonblocking() to
961 * make it so). This function is shared by various transports that
962 * boil down to a full duplex file descriptor.
964 * @param fd the file descriptor.
965 * @param server #TRUE if this transport is on the server side of a connection
966 * @returns the new transport, or #NULL if no memory.
969 _dbus_transport_new_for_fd (int fd,
972 DBusTransportUnix *unix_transport;
974 unix_transport = dbus_new0 (DBusTransportUnix, 1);
975 if (unix_transport == NULL)
978 if (!_dbus_string_init (&unix_transport->encoded_outgoing,
982 if (!_dbus_string_init (&unix_transport->encoded_incoming,
986 unix_transport->write_watch = _dbus_watch_new (fd,
989 if (unix_transport->write_watch == NULL)
992 unix_transport->read_watch = _dbus_watch_new (fd,
995 if (unix_transport->read_watch == NULL)
998 if (!_dbus_transport_init_base (&unix_transport->base,
1003 unix_transport->fd = fd;
1004 unix_transport->message_bytes_written = 0;
1006 /* These values should probably be tunable or something. */
1007 unix_transport->max_bytes_read_per_iteration = 2048;
1008 unix_transport->max_bytes_written_per_iteration = 2048;
1010 return (DBusTransport*) unix_transport;
1013 _dbus_watch_unref (unix_transport->read_watch);
1015 _dbus_watch_unref (unix_transport->write_watch);
1017 _dbus_string_free (&unix_transport->encoded_incoming);
1019 _dbus_string_free (&unix_transport->encoded_outgoing);
1021 dbus_free (unix_transport);
1026 * Creates a new transport for the given Unix domain socket
1029 * @param path the path to the domain socket.
1030 * @param server #TRUE if this transport is on the server side of a connection
1031 * @param result location to store reason for failure.
1032 * @returns a new transport, or #NULL on failure.
1035 _dbus_transport_new_for_domain_socket (const char *path,
1037 DBusResultCode *result)
1040 DBusTransport *transport;
1042 fd = _dbus_connect_unix_socket (path, result);
1046 _dbus_fd_set_close_on_exec (fd);
1048 _dbus_verbose ("Successfully connected to unix socket %s\n",
1051 transport = _dbus_transport_new_for_fd (fd, server);
1052 if (transport == NULL)
1054 dbus_set_result (result, DBUS_RESULT_NO_MEMORY);
1055 _dbus_close (fd, NULL);
1063 * Creates a new transport for the given hostname and port.
1065 * @param host the host to connect to
1066 * @param port the port to connect to
1067 * @param server #TRUE if this transport is on the server side of a connection
1068 * @param result location to store reason for failure.
1069 * @returns a new transport, or #NULL on failure.
1072 _dbus_transport_new_for_tcp_socket (const char *host,
1075 DBusResultCode *result)
1078 DBusTransport *transport;
1080 fd = _dbus_connect_tcp_socket (host, port, result);
1084 _dbus_fd_set_close_on_exec (fd);
1086 _dbus_verbose ("Successfully connected to tcp socket %s:%d\n",
1089 transport = _dbus_transport_new_for_fd (fd, server);
1090 if (transport == NULL)
1092 dbus_set_result (result, DBUS_RESULT_NO_MEMORY);
1093 _dbus_close (fd, NULL);