summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-02-16 16:14:14 -0800
committerJeremy Allison <jra@samba.org>2012-02-17 02:49:13 +0100
commited85e9fe6a10d3c34b74788e6f862ea23dce4f2b (patch)
tree639223aa489d3118b40f289be559a40759473353 /source3
parent367c567c5f35db202474c8d3f730484538e1fb97 (diff)
downloadsamba-ed85e9fe6a10d3c34b74788e6f862ea23dce4f2b.tar.gz
samba-ed85e9fe6a10d3c34b74788e6f862ea23dce4f2b.tar.bz2
samba-ed85e9fe6a10d3c34b74788e6f862ea23dce4f2b.zip
Replace smbd_server_connection_loop_once() with tevent_loop_once() directly.
We no longer need to call poll() directly inside smbd ! Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Feb 17 02:49:13 CET 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/process.c69
1 files changed, 6 insertions, 63 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index f295a59f86..1d74355289 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -941,60 +941,6 @@ static void smbd_conf_updated(struct messaging_context *msg,
reload_services(sconn, conn_snum_used, false);
}
-static NTSTATUS smbd_server_connection_loop_once(struct tevent_context *ev_ctx,
- struct smbd_server_connection *conn)
-{
- int timeout;
- int num_pfds = 0;
- int ret;
- bool retry;
-
- timeout = SMBD_SELECT_TIMEOUT * 1000;
-
- /*
- * Are there any timed events waiting ? If so, ensure we don't
- * select for longer than it would take to wait for them.
- */
-
- event_add_to_poll_args(ev_ctx, conn, &conn->pfds, &num_pfds, &timeout);
-
- /* Process a signal and timed events now... */
- if (run_events_poll(ev_ctx, 0, NULL, 0)) {
- return NT_STATUS_RETRY;
- }
-
- {
- int sav;
- START_PROFILE(smbd_idle);
-
- ret = poll(conn->pfds, num_pfds, timeout);
- sav = errno;
-
- END_PROFILE(smbd_idle);
- errno = sav;
- }
-
- if (ret == -1) {
- if (errno == EINTR) {
- return NT_STATUS_RETRY;
- }
- return map_nt_error_from_unix(errno);
- }
-
- retry = run_events_poll(ev_ctx, ret, conn->pfds, num_pfds);
- if (retry) {
- return NT_STATUS_RETRY;
- }
-
- /* Did we timeout ? */
- if (ret == 0) {
- return NT_STATUS_RETRY;
- }
-
- /* should not be reached */
- return NT_STATUS_INTERNAL_ERROR;
-}
-
/*
* Only allow 5 outstanding trans requests. We're allocating memory, so
* prevent a DoS.
@@ -3380,18 +3326,15 @@ void smbd_process(struct tevent_context *ev_ctx,
TALLOC_FREE(frame);
while (True) {
- NTSTATUS status;
-
frame = talloc_stackframe_pool(8192);
errno = 0;
-
- 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,"
- " exiting\n", nt_errstr(status)));
- break;
+ if (tevent_loop_once(ev_ctx) == -1) {
+ if (errno != EINTR) {
+ DEBUG(3, ("tevent_loop_once failed: %s,"
+ " exiting\n", strerror(errno) ));
+ break;
+ }
}
TALLOC_FREE(frame);