James Moger
2014-03-03 94e12c168f5eec300fd23d0de25c7dc93a96c429
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);