if (!(conn=TALLOC_ZERO_P(mem_ctx, connection_struct)) ||
!(conn->params = TALLOC_P(mem_ctx, struct share_params))) {
- DEBUG(0,("talloc_zero() failed!\n"));
+ DEBUG(0,("TALLOC_ZERO() failed!\n"));
TALLOC_FREE(mem_ctx);
return NULL;
}
Idle inactive connections.
****************************************************************************/
-BOOL conn_idle_all(time_t t, int deadtime)
+BOOL conn_idle_all(time_t t)
{
+ int deadtime = lp_deadtime()*60;
pipes_struct *plist = NULL;
- BOOL allidle = True;
- connection_struct *conn, *next;
+ connection_struct *conn;
- for (conn=Connections;conn;conn=next) {
- next=conn->next;
+ if (deadtime <= 0)
+ deadtime = DEFAULT_SMBD_TIMEOUT;
+
+ for (conn=Connections;conn;conn=conn->next) {
+
+ time_t age = t - conn->lastused;
/* Update if connection wasn't idle. */
if (conn->lastused != conn->lastused_count) {
}
/* close dirptrs on connections that are idle */
- if ((t-conn->lastused) > DPTR_IDLE_TIMEOUT) {
+ if (age > DPTR_IDLE_TIMEOUT) {
dptr_idlecnum(conn);
}
- if (conn->num_files_open > 0 || (t-conn->lastused)<deadtime) {
- allidle = False;
+ if (conn->num_files_open > 0 || age < deadtime) {
+ return False;
}
}
* idle with a handle open.
*/
- for (plist = get_first_internal_pipe(); plist; plist = get_next_internal_pipe(plist))
- if (plist->pipe_handles && plist->pipe_handles->count)
- allidle = False;
+ for (plist = get_first_internal_pipe(); plist;
+ plist = get_next_internal_pipe(plist)) {
+ if (plist->pipe_handles && plist->pipe_handles->count) {
+ return False;
+ }
+ }
- return allidle;
+ return True;
}
/****************************************************************************
free_namearray(conn->veto_list);
free_namearray(conn->hide_list);
free_namearray(conn->veto_oplock_list);
- free_namearray(conn->aio_write_behind_list);
string_free(&conn->user);
string_free(&conn->dirpath);
DLIST_REMOVE(Connections, conn);
bitmap_clear(bmap, conn->cnum);
+
+ SMB_ASSERT(num_open > 0);
num_open--;
conn_free_internal(conn);
share are unmounted
the special sharename '*' forces unmount of all shares
****************************************************************************/
-void msg_force_tdis(int msg_type, struct process_id pid, void *buf, size_t len)
+void msg_force_tdis(int msg_type, struct server_id pid, void *buf, size_t len,
+ void *private_data)
{
connection_struct *conn, *next;
fstring sharename;