From 03a03105bc613cf8b87aa67938e9c940197ef511 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 27 Mar 2014 09:31:57 -0400
Subject: [PATCH] Change build identifier to 1.5.0-SNAPSHOT
---
src/main/java/com/gitblit/git/GitDaemon.java | 51 ++++++++++++++++-----------------------------------
1 files changed, 16 insertions(+), 35 deletions(-)
diff --git a/src/main/java/com/gitblit/git/GitDaemon.java b/src/main/java/com/gitblit/git/GitDaemon.java
index bb578ef..d026b5e 100644
--- a/src/main/java/com/gitblit/git/GitDaemon.java
+++ b/src/main/java/com/gitblit/git/GitDaemon.java
@@ -43,7 +43,6 @@
*/
package com.gitblit.git;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
@@ -68,6 +67,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.gitblit.IStoredSettings;
+import com.gitblit.Keys;
+import com.gitblit.manager.IGitblit;
import com.gitblit.utils.StringUtils;
/**
@@ -106,45 +108,24 @@
private ReceivePackFactory<GitDaemonClient> receivePackFactory;
- /** Configure a daemon to listen on any available network port. */
- public GitDaemon() {
- this(null);
- }
+ public GitDaemon(IGitblit gitblit) {
- /**
- * Construct the Gitblit Git daemon.
- *
- * @param bindInterface
- * the ip address of the interface to bind
- * @param port
- * the port to serve on
- * @param folder
- * the folder to serve from
- */
- public GitDaemon(String bindInterface, int port, File folder) {
- this(StringUtils.isEmpty(bindInterface) ? new InetSocketAddress(port)
- : new InetSocketAddress(bindInterface, port));
+ IStoredSettings settings = gitblit.getSettings();
+ int port = settings.getInteger(Keys.git.daemonPort, 0);
+ String bindInterface = settings.getString(Keys.git.daemonBindInterface, "localhost");
- // set the repository resolver and pack factories
- repositoryResolver = new RepositoryResolver<GitDaemonClient>(folder);
- }
+ if (StringUtils.isEmpty(bindInterface)) {
+ myAddress = new InetSocketAddress(port);
+ } else {
+ myAddress = new InetSocketAddress(bindInterface, port);
+ }
- /**
- * Configure a new daemon for the specified network address.
- *
- * @param addr
- * address to listen for connections on. If null, any available
- * port will be chosen on all network interfaces.
- */
- public GitDaemon(final InetSocketAddress addr) {
- myAddress = addr;
- processors = new ThreadGroup("Git-Daemon");
+ repositoryResolver = new RepositoryResolver<GitDaemonClient>(gitblit);
+ uploadPackFactory = new GitblitUploadPackFactory<GitDaemonClient>(gitblit);
+ receivePackFactory = new GitblitReceivePackFactory<GitDaemonClient>(gitblit);
run = new AtomicBoolean(false);
- repositoryResolver = null;
- uploadPackFactory = new GitblitUploadPackFactory<GitDaemonClient>();
- receivePackFactory = new GitblitReceivePackFactory<GitDaemonClient>();
-
+ processors = new ThreadGroup("Git-Daemon");
services = new GitDaemonService[] { new GitDaemonService("upload-pack", "uploadpack") {
{
setEnabled(true);
--
Gitblit v1.9.1