Exemplo n.º 1
0
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
        /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
        internal virtual void Execute(Socket sock)
        {
            rawIn  = new BufferedInputStream(sock.GetInputStream());
            rawOut = new SafeBufferedOutputStream(sock.GetOutputStream());
            if (0 < daemon.GetTimeout())
            {
                sock.ReceiveTimeout = daemon.GetTimeout() * 1000;
            }
            string cmd = new PacketLineIn(rawIn).ReadStringRaw();
            int    nul = cmd.IndexOf('\0');

            if (nul >= 0)
            {
                // Newer clients hide a "host" header behind this byte.
                // Currently we don't use it for anything, so we ignore
                // this portion of the command.
                //
                cmd = Sharpen.Runtime.Substring(cmd, 0, nul);
            }
            DaemonService srv = GetDaemon().MatchService(cmd);

            if (srv == null)
            {
                return;
            }
            sock.ReceiveTimeout = 0;
            srv.Execute(this, cmd);
        }
Exemplo n.º 2
0
		/// <exception cref="System.IO.IOException"></exception>
		internal virtual void Execute(Socket sock)
		{
			rawIn = new BufferedInputStream(sock.GetInputStream());
			rawOut = new BufferedOutputStream(sock.GetOutputStream());
			if (0 < daemon.GetTimeout())
			{
				sock.ReceiveTimeout = daemon.GetTimeout() * 1000;
			}
			string cmd = new PacketLineIn(rawIn).ReadStringRaw();
			int nul = cmd.IndexOf('\0');
			if (nul >= 0)
			{
				// Newer clients hide a "host" header behind this byte.
				// Currently we don't use it for anything, so we ignore
				// this portion of the command.
				//
				cmd = Sharpen.Runtime.Substring(cmd, 0, nul);
			}
			DaemonService srv = GetDaemon().MatchService(cmd);
			if (srv == null)
			{
				return;
			}
			sock.ReceiveTimeout = 0;
			srv.Execute(this, cmd);
		}