1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

s3-smbd: Pass tevent context to smbd_server_connection_loop_once().

Signed-off-by: Simo Sorce <idra@samba.org>
This commit is contained in:
Andreas Schneider 2011-08-08 18:39:56 +02:00
parent bc3fae70a2
commit dd3a927959
3 changed files with 17 additions and 16 deletions

View File

@ -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,"

View File

@ -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 */

View File

@ -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);