From: Stefan Metzmacher Date: Sun, 17 Feb 2013 21:41:00 +0000 (+0100) Subject: TODO s4:libcli/smb2: don't schedule idle handlers on a dead connection X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=7b7956ee0f31d8c6be72f67e019872149af02151 TODO s4:libcli/smb2: don't schedule idle handlers on a dead connection --- diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c index 166f34b82569..b501b52ce518 100644 --- a/source4/libcli/smb2/transport.c +++ b/source4/libcli/smb2/transport.c @@ -456,6 +456,14 @@ static void idle_handler(struct tevent_context *ev, transport->idle.func(transport, transport->idle.private_data); + if (transport->idle.func == NULL) { + return; + } + + if (!smbXcli_conn_is_connected(transport->conn)) { + return; + } + next = timeval_current_ofs_usec(transport->idle.period); transport->idle.te = tevent_add_timer(transport->ev, transport, @@ -474,6 +482,15 @@ void smb2_transport_idle_handler(struct smb2_transport *transport, void *private_data) { TALLOC_FREE(transport->idle.te); + ZERO_STRUCT(transport->idle); + + if (idle_func == NULL) { + return; + } + + if (!smbXcli_conn_is_connected(transport->conn)) { + return; + } transport->idle.func = idle_func; transport->idle.private_data = private_data;