From 049429570543e27bfdaca721b8347bfa2ed22635 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 27 Aug 2013 15:54:59 +0100 Subject: [PATCH] mirror: Ensure the mirror client socket is closed after a fail, and before a retry --- src/mirror.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mirror.c b/src/mirror.c index d7338b1..6f6de55 100644 --- a/src/mirror.c +++ b/src/mirror.c @@ -861,6 +861,16 @@ void* mirror_runner(void* serve_params_uncast) } mirror_run( serve ); + + /* On success, this is unnecessary, and harmless ( mirror_cleanup does it + * for us ). But if we've failed and are going to retry on the next run, we + * must close this socket here to have any chance of it succeeding. + */ + if ( !mirror->client < 0 ) { + sock_try_close( mirror->client ); + mirror->client = -1; + } + abandon_mirror: return NULL; }