From 6d5e12e1b6abc2f07af547478f2497e06df988b1 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 25 Jan 2011 11:46:15 +0100 Subject: Fix cleanup when ssh connection is terminated. This prevents sshfs hanging when the server is rebooted, for example. --- sshfs.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'sshfs.c') diff --git a/sshfs.c b/sshfs.c index 61f2b92..81ee64a 100644 --- a/sshfs.c +++ b/sshfs.c @@ -1314,17 +1314,16 @@ static void *process_requests(void *data_) break; } + pthread_mutex_lock(&sshfs.lock); + sshfs.processing_thread_started = 0; + close_conn(); + g_hash_table_foreach_remove(sshfs.reqtab, (GHRFunc) clean_req, NULL); + sshfs.connver ++; + pthread_mutex_unlock(&sshfs.lock); + if (!sshfs.reconnect) { /* harakiri */ kill(getpid(), SIGTERM); - } else { - pthread_mutex_lock(&sshfs.lock); - sshfs.processing_thread_started = 0; - close_conn(); - g_hash_table_foreach_remove(sshfs.reqtab, (GHRFunc) clean_req, - NULL); - sshfs.connver ++; - pthread_mutex_unlock(&sshfs.lock); } return NULL; } -- cgit v1.2.3