static void nbd_accept(void *opaque) { int server_fd = (uintptr_t) opaque; struct sockaddr_in addr; socklen_t addr_len = sizeof(addr); int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len); nbd_started = true; if (fd >= 0 && nbd_client_new(exp, fd, nbd_client_closed)) { nb_fds++; } }
static void nbd_accept(void *opaque) { int server_fd = (uintptr_t) opaque; struct sockaddr_in addr; socklen_t addr_len = sizeof(addr); int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len); if (fd < 0) { perror("accept"); return; } if (state >= TERMINATE) { close(fd); return; } if (fd >= 0 && nbd_client_new(exp, fd, nbd_client_closed)) { nb_fds++; } }
static gboolean nbd_accept(QIOChannel *ioc, GIOCondition condition, gpointer opaque) { QIOChannelSocket *cioc; if (!nbd_server) { return FALSE; } cioc = qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc), NULL); if (!cioc) { return TRUE; } qio_channel_set_name(QIO_CHANNEL(cioc), "nbd-server"); nbd_client_new(NULL, cioc, nbd_server->tlscreds, NULL, nbd_blockdev_client_closed); object_unref(OBJECT(cioc)); return TRUE; }
static gboolean nbd_accept(QIOChannel *ioc, GIOCondition cond, gpointer opaque) { QIOChannelSocket *cioc; cioc = qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc), NULL); if (!cioc) { return TRUE; } if (state >= TERMINATE) { object_unref(OBJECT(cioc)); return TRUE; } nb_fds++; nbd_update_server_watch(); nbd_client_new(newproto ? NULL : exp, cioc, tlscreds, NULL, nbd_client_closed); object_unref(OBJECT(cioc)); return TRUE; }
static void nbd_accept(void *opaque) { struct sockaddr_in addr; socklen_t addr_len = sizeof(addr); int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len); if (fd < 0) { perror("accept"); return; } if (state >= TERMINATE) { close(fd); return; } if (nbd_client_new(exp, fd, nbd_client_closed)) { nb_fds++; nbd_update_server_fd_handler(server_fd); } else { shutdown(fd, 2); close(fd); } }