struct rdma_cm_event *cm_event;
} rdma;
struct smb_direct_connection *ready;
+ struct tevent_req *listen_req;
};
struct smb_direct_connection {
static int smb_direct_listener_destructor(struct smb_direct_listener *l);
+static void smb_direct_listener_accept_rdma_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags,
+ void *private_data);
+
NTSTATUS smbd_direct_listener_setup(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
const struct sockaddr_storage *addr,
struct smb_direct_listener **_l)
{
return status;
}
- l->rdma.cm_channel = l->rdma.cm_id->channel;
+ l->rdma.fde_channel = tevent_add_fd(ev, l,
+ l->rdma.cm_channel->fd,
+ TEVENT_FD_READ,
+ smb_direct_listener_accept_rdma_handler,
+ l);
+ if (l->rdma.fde_channel == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
errno = 0;
ret = rdma_bind_addr(l->rdma.cm_id, bind_addr);
return 0;
}
-static void smb_direct_listener_accept_rdma_handler(struct tevent_context *ev,
- struct tevent_fd *fde,
- uint16_t flags,
- void *private_data);
-
struct tevent_req *smb_direct_listener_accept_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smb_direct_listener *l)
state->l = l;
talloc_set_destructor(state, smb_direct_listener_accept_state_destructor);
- smb_direct_listener_accept_rdma_handler(ev, NULL, 0, req);
-
+ if (0) {
l->rdma.fde_channel = tevent_add_fd(ev, state,
l->rdma.cm_channel->fd,
TEVENT_FD_READ,
if (tevent_req_nomem(l->rdma.fde_channel, req)) {
return tevent_req_post(req, ev);
}
+ }
+ l->listen_req = req;
DBG_ERR("SMB-D daemon started accepting SMB-D connections on listener[%p]\n", l);
return req;
uint16_t flags,
void *private_data)
{
+#if 0
struct tevent_req *req =
talloc_get_type_abort(private_data,
struct tevent_req);
tevent_req_data(req,
struct smb_direct_listener_accept_state);
struct smb_direct_listener *l = state->l;
+#endif
+ struct smb_direct_listener *l = talloc_get_type_abort(
+ private_data, struct smb_direct_listener);
+ struct tevent_req *req = l->listen_req;
+ struct smb_direct_listener_accept_state *state =
+ tevent_req_data(req,
+ struct smb_direct_listener_accept_state);
NTSTATUS status;
int ret;
}
static void smb_direct_daemon_stopped(struct tevent_req *req);
-
+#if 0
static void smb_direct_daemon_accept_done(struct tevent_req *subreq)
{
struct tevent_context *ev = tevent_req_callback_data(subreq,
close(fd);
DEBUG(0,("%s:%s: here...\n", __location__, __func__));
}
-
+#endif
static bool smb_direct_daemon_init(struct tevent_context *ev,
struct messaging_context *msg,
bool interactive,
if (interactive) {
+#if 0
struct smb_direct_listener *l = NULL;
struct tevent_req *subreq = NULL;
struct sockaddr_storage bind_addr;
tevent_req_set_callback(subreq,
smb_direct_daemon_accept_done,
ev);
-
+#endif
req = tevent_wakeup_send(ev, ev, timeval_current_ofs(999999,0));
*ppid = getpid();
return (req != NULL);
int result;
bool ok;
- if (0) {
parent->smbd_ctr_socket = smb_direct_socket(parent);
if (parent->smbd_ctr_socket == NULL) {
DBG_ERR("smb_direct_socket failed\n");
}
DBG_ERR("smb_direct_ping got [%" PRIx32 "]\n", ping_data);
- }
+
s = talloc_zero(parent, struct smbd_open_socket);
if (s == NULL) {
return false;
}
-if (0) {
+
result = smb_direct_bind(parent->smbd_ctr_socket, NULL);
if (result != 0) {
DBG_ERR("smb_direct_bind failed\n");
}
tevent_fd_set_close_fn(s->fde, smbd_open_socket_close_fn);
-}
+
DLIST_ADD_END(parent->sockets, s);
return true;