static void ss_listener_event_func(int _fd, unsigned ev, void *_l) { asocket *s; if(ev & FDE_READ) { struct sockaddr addr; socklen_t alen; int fd; alen = sizeof(addr); fd = adb_socket_accept(_fd, &addr, &alen); if(fd < 0) return; adb_socket_setbufsize(fd, CHUNK_SIZE); s = create_local_socket(fd); if(s) { D("in ss_listener_event_func connecting to smartsocket\n"); connect_to_smartsocket(s); return; } adb_close(fd); } }
static void ss_listener_event_func(int _fd, unsigned ev, void *_l) { if (ev & FDE_READ) { int fd = adb_socket_accept(_fd, nullptr, nullptr); if (fd < 0) return; int rcv_buf_size = CHUNK_SIZE; adb_setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcv_buf_size, sizeof(rcv_buf_size)); asocket* s = create_local_socket(fd); if (s) { connect_to_smartsocket(s); return; } adb_close(fd); } }
static void ss_listener_event_func(int _fd, unsigned ev, void *_l) { if (ev & FDE_READ) { sockaddr_storage ss; sockaddr* addrp = reinterpret_cast<sockaddr*>(&ss); socklen_t alen = sizeof(ss); int fd = adb_socket_accept(_fd, addrp, &alen); if (fd < 0) return; int rcv_buf_size = CHUNK_SIZE; adb_setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcv_buf_size, sizeof(rcv_buf_size)); asocket* s = create_local_socket(fd); if (s) { connect_to_smartsocket(s); return; } adb_close(fd); } }