From: James Moger Date: Tue, 2 Jul 2013 18:51:42 +0000 (-0400) Subject: Fixed GitDaemon stop for unit tests X-Git-Tag: v1.3.0~29 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2e4b03f7fe33ed5b84ec98ce689f3e1cabf97bff;p=gitblit.git Fixed GitDaemon stop for unit tests --- diff --git a/src/main/java/com/gitblit/git/GitDaemon.java b/src/main/java/com/gitblit/git/GitDaemon.java index 3c45171f..b760fbcc 100644 --- a/src/main/java/com/gitblit/git/GitDaemon.java +++ b/src/main/java/com/gitblit/git/GitDaemon.java @@ -245,8 +245,8 @@ public class GitDaemon { // } finally { acceptSocket = null; - acceptThread = null; } + } }; acceptThread.start(); @@ -261,9 +261,9 @@ public class GitDaemon { /** Stop this daemon. */ public synchronized void stop() { - if (acceptThread != null) { - logger.info("Git Daemon stopping..."); + if (isRunning() && acceptThread != null) { run.set(false); + logger.info("Git Daemon stopping..."); try { // close the accept socket // this throws a SocketException in the accept thread @@ -276,6 +276,8 @@ public class GitDaemon { logger.info("Git Daemon stopped."); } catch (InterruptedException e) { logger.error("Accept thread join interrupted", e); + } finally { + acceptThread = null; } } }