Lines Matching refs:socket

26 #include <sys/socket.h>
34 #include "osi/include/socket.h"
37 // This module provides a socket abstraction for SCO connections to a higher
52 // socket_read_ready_cb() - local host closed SCO socket
57 socket_t *socket;
75 static void sco_socket_free_locked(sco_socket_t *socket);
80 static void socket_read_ready_cb(socket_t *socket, void *context);
144 LOG_ERROR("%s unable to allocate socket pair: %s", __func__, strerror(errno));
150 LOG_ERROR("%s unable to allocate new SCO socket.", __func__);
156 LOG_ERROR("%s unable to create SCO socket: %d", __func__, status);
160 socket_t *socket = socket_new_from_fd(pair[1]);
161 if (!socket) {
162 LOG_ERROR("%s unable to allocate socket from file descriptor %d.", __func__, pair[1]);
167 sco_socket->socket = socket; // Hang on to the other end.
170 socket_register(socket, thread_get_reactor(thread), sco_socket, socket_read_ready_cb, NULL);
190 // Must be called with |lock| held except during teardown when we know the socket thread
198 socket_free(sco_socket->socket);
231 LOG_ERROR("%s received connection request on non-listening socket handle: %hu", __func__, conn_data->sco_inx);
241 // Swap socket->sco_handle and new_socket->sco_handle
252 if (socket_write_and_transfer_fd(sco_socket->socket, &connect_signal, sizeof(connect_signal), client_fd) != sizeof(connect_signal)) {
253 LOG_ERROR("%s unable to send new file descriptor to listening socket.", __func__);
276 LOG_ERROR("%s SCO socket not found on connect for handle: %hu", __func__, sco_handle);
280 // If sco_socket->socket was closed, we should tear down because there is no app-level
281 // interest in the SCO socket.
282 if (!sco_socket->socket) {
299 LOG_ERROR("%s SCO socket not found on disconnect for handle: %hu", __func__, sco_handle);
309 static void socket_read_ready_cb(UNUSED_ATTR socket_t *socket, void *context) {
313 socket_free(sco_socket->socket);
314 sco_socket->socket = NULL;
319 // sco_socket->socket == NULL indicates to the connect callback
320 // routine that the socket is no longer desired and should be torn