From 010c725b36feb1a234dce9f40b95ae5869058698 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 15 Apr 2006 04:07:10 +0000 Subject: r15088: Remove all time() and gettimeofday() calls out of the mainline packet processing code. Only do these when needed (ie. in the idle timeout code). We drop an unneccessary global here too. Jeremy. (This used to be commit 8272a5ab0605fcf95527143c4f909aa1008e5b94) --- source3/smbd/conn.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source3/smbd/conn.c') diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index b41467f02c..5aa8901d59 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -154,8 +154,9 @@ find_again: } /**************************************************************************** -close all conn structures + Close all conn structures. ****************************************************************************/ + void conn_close_all(void) { connection_struct *conn, *next; @@ -178,13 +179,20 @@ BOOL conn_idle_all(time_t t, int deadtime) for (conn=Connections;conn;conn=next) { next=conn->next; + + /* Update if connection wasn't idle. */ + if (conn->lastused != conn->lastused_count) { + conn->lastused = t; + } + /* close dirptrs on connections that are idle */ - if ((t-conn->lastused) > DPTR_IDLE_TIMEOUT) + if ((t-conn->lastused) > DPTR_IDLE_TIMEOUT) { dptr_idlecnum(conn); + } - if (conn->num_files_open > 0 || - (t-conn->lastused)num_files_open > 0 || (t-conn->lastused)