diff options
author | Andreas Schneider <asn@samba.org> | 2011-08-08 18:39:56 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2011-08-09 10:41:47 +0200 |
commit | dd3a92795908e8e9e5456f985e17313b2a59a8cc (patch) | |
tree | e896e63c23289fcd7bc74ef90234edd4f180ab2f | |
parent | bc3fae70a27ced752844513996f29d0116a20079 (diff) | |
download | samba-dd3a92795908e8e9e5456f985e17313b2a59a8cc.tar.gz samba-dd3a92795908e8e9e5456f985e17313b2a59a8cc.tar.bz2 samba-dd3a92795908e8e9e5456f985e17313b2a59a8cc.zip |
s3-smbd: Pass tevent context to smbd_server_connection_loop_once().
Signed-off-by: Simo Sorce <idra@samba.org>
-rw-r--r-- | source3/smbd/process.c | 24 | ||||
-rw-r--r-- | source3/smbd/proto.h | 3 | ||||
-rw-r--r-- | source3/smbd/server.c | 6 |
3 files changed, 17 insertions, 16 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index b105de7614..fc6112c161 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -903,7 +903,8 @@ void smbd_setup_sig_hup_handler(struct tevent_context *ev, } } -static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *conn) +static NTSTATUS smbd_server_connection_loop_once(struct tevent_context *ev_ctx, + struct smbd_server_connection *conn) { int timeout; int num_pfds = 0; @@ -917,11 +918,10 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection * * select for longer than it would take to wait for them. */ - event_add_to_poll_args(server_event_context(), conn, - &conn->pfds, &num_pfds, &timeout); + event_add_to_poll_args(ev_ctx, conn, &conn->pfds, &num_pfds, &timeout); /* Process a signal and timed events now... */ - if (run_events_poll(server_event_context(), 0, NULL, 0)) { + if (run_events_poll(ev_ctx, 0, NULL, 0)) { return NT_STATUS_RETRY; } @@ -943,8 +943,7 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection * return map_nt_error_from_unix(errno); } - retry = run_events_poll(server_event_context(), ret, conn->pfds, - num_pfds); + retry = run_events_poll(ev_ctx, ret, conn->pfds, num_pfds); if (retry) { return NT_STATUS_RETRY; } @@ -2960,7 +2959,8 @@ static NTSTATUS smbd_register_ips(struct smbd_server_connection *sconn, Process commands from the client ****************************************************************************/ -void smbd_process(struct smbd_server_connection *sconn) +void smbd_process(struct tevent_context *ev_ctx, + struct smbd_server_connection *sconn) { TALLOC_CTX *frame = talloc_stackframe(); struct sockaddr_storage ss; @@ -3128,7 +3128,7 @@ void smbd_process(struct smbd_server_connection *sconn) MSG_DEBUG, debug_message); if ((lp_keepalive() != 0) - && !(event_add_idle(server_event_context(), NULL, + && !(event_add_idle(ev_ctx, NULL, timeval_set(lp_keepalive(), 0), "keepalive", keepalive_fn, NULL))) { @@ -3136,14 +3136,14 @@ void smbd_process(struct smbd_server_connection *sconn) exit(1); } - if (!(event_add_idle(server_event_context(), NULL, + if (!(event_add_idle(ev_ctx, NULL, timeval_set(IDLE_CLOSED_TIMEOUT, 0), "deadtime", deadtime_fn, sconn))) { DEBUG(0, ("Could not add deadtime event\n")); exit(1); } - if (!(event_add_idle(server_event_context(), NULL, + if (!(event_add_idle(ev_ctx, NULL, timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0), "housekeeping", housekeeping_fn, sconn))) { DEBUG(0, ("Could not add housekeeping event\n")); @@ -3200,7 +3200,7 @@ void smbd_process(struct smbd_server_connection *sconn) exit_server("init_dptrs() failed"); } - sconn->smb1.fde = event_add_fd(server_event_context(), + sconn->smb1.fde = event_add_fd(ev_ctx, sconn, sconn->sock, EVENT_FD_READ, @@ -3219,7 +3219,7 @@ void smbd_process(struct smbd_server_connection *sconn) errno = 0; - status = smbd_server_connection_loop_once(sconn); + status = smbd_server_connection_loop_once(ev_ctx, sconn); if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY) && !NT_STATUS_IS_OK(status)) { DEBUG(3, ("smbd_server_connection_loop_once failed: %s," diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 92a1d3876d..d140813438 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -793,7 +793,8 @@ void construct_reply_common_req(struct smb_request *req, char *outbuf); size_t req_wct_ofs(struct smb_request *req); void chain_reply(struct smb_request *req); bool req_is_in_chain(struct smb_request *req); -void smbd_process(struct smbd_server_connection *sconn); +void smbd_process(struct tevent_context *ev_ctx, + struct smbd_server_connection *sconn); bool fork_echo_handler(struct smbd_server_connection *sconn); /* The following definitions come from smbd/quotas.c */ diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 8aa4f5f093..9e17e07a41 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -393,7 +393,7 @@ static void smbd_accept_connection(struct tevent_context *ev, } if (s->parent->interactive) { - smbd_process(sconn); + smbd_process(ev, sconn); exit_server_cleanly("end of interactive mode"); return; } @@ -472,7 +472,7 @@ static void smbd_accept_connection(struct tevent_context *ev, "serverid.tdb"); } - smbd_process(smbd_server_conn); + smbd_process(ev, smbd_server_conn); exit: exit_server_cleanly("end of child"); return; @@ -1259,7 +1259,7 @@ extern void build_options(bool screen); /* Stop zombies */ smbd_setup_sig_chld_handler(ev_ctx); - smbd_process(smbd_server_conn); + smbd_process(ev_ctx, smbd_server_conn); exit_server_cleanly(NULL); return(0); |