| | |
| | | }
|
| | | } };
|
| | | }
|
| | | |
| | | public int getPort() {
|
| | | return myAddress.getPort();
|
| | | }
|
| | | |
| | | public String formatUrl(String servername, String repository) {
|
| | | if (getPort() == 9418) {
|
| | | // standard port
|
| | | return MessageFormat.format("git://{0}/{1}", servername, repository);
|
| | | } else {
|
| | | // non-standard port
|
| | | return MessageFormat.format("git://{0}:{1,number,0}/{2}", servername, getPort(), repository);
|
| | | }
|
| | | }
|
| | |
|
| | | /** @return timeout (in seconds) before aborting an IO operation. */
|
| | | public int getTimeout() {
|
| | |
| | | //
|
| | | } finally {
|
| | | acceptSocket = null;
|
| | | acceptThread = null;
|
| | | }
|
| | |
|
| | | }
|
| | | };
|
| | | acceptThread.start();
|
| | |
| | |
|
| | | /** 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
|
| | |
| | | logger.info("Git Daemon stopped.");
|
| | | } catch (InterruptedException e) {
|
| | | logger.error("Accept thread join interrupted", e);
|
| | | } finally {
|
| | | acceptThread = null;
|
| | | }
|
| | | }
|
| | | }
|