BOOL conn_idle_all(time_t t, int deadtime) { pipes_struct *plist = NULL; BOOL allidle = True; connection_struct *conn, *next; for (conn=Connections;conn;conn=next) { next=conn->next; /* close dirptrs on connections that are idle */ if ((t-conn->lastused) > DPTR_IDLE_TIMEOUT) dptr_idlecnum(conn); if (conn->num_files_open > 0 || (t-conn->lastused)<deadtime) allidle = False; } /* * Check all pipes for any open handles. We cannot * idle with a handle open. */ for (plist = get_first_pipe(); plist; plist = get_next_pipe(plist)) if (plist->pipe_handles && plist->pipe_handles->count) allidle = False; return allidle; }
bool conn_idle_all(struct smbd_server_connection *sconn, time_t t) { int deadtime = lp_deadtime()*60; struct connection_struct *conn; conn_lastused_update(sconn, t); if (deadtime <= 0) { deadtime = DEFAULT_SMBD_TIMEOUT; } for (conn=sconn->connections;conn;conn=conn->next) { time_t age = t - conn->lastused; /* close dirptrs on connections that are idle */ if (age > DPTR_IDLE_TIMEOUT) { dptr_idlecnum(conn); } if (conn->num_files_open > 0 || age < deadtime) { return false; } } /* * Check all pipes for any open handles. We cannot * idle with a handle open. */ if (check_open_pipes()) { return false; } return true; }