Ejemplo n.º 1
0
			public override void Execute(DaemonClient client, Repository db)
			{
				var rp = new UploadPack(db);
				Stream stream = client.Stream;
				rp.Upload(stream, null, null);
			}
Ejemplo n.º 2
0
			public override void Execute(DaemonClient client, Repository db)
			{
				EndPoint peer = client.Peer;

				var ipEndpoint = peer as IPEndPoint;
				if (ipEndpoint == null)
				{
					throw new InvalidOperationException("peer must be a IPEndPoint");
				}

				string host = Dns.GetHostEntry(ipEndpoint.Address).HostName ?? ipEndpoint.Address.ToString();
				var rp = new ReceivePack(db);
				Stream stream = client.Stream;
				const string name = "anonymous";
				string email = name + "@" + host;
				rp.setRefLogIdent(new PersonIdent(name, email));
				rp.receive(stream, stream, null);
			}
Ejemplo n.º 3
0
		private void startClient(Socket s)
		{
			var dc = new DaemonClient(this) { Peer = s.RemoteEndPoint };

			// [caytchen] TODO: insanse anonymous methods were ported 1:1 from jgit, do properly sometime
			var t = new Thread(
				new ThreadStart(delegate
									{
										using(NetworkStream stream = new NetworkStream(s))
										{
											try
											{
												dc.Execute(new BufferedStream(stream));
											}
											catch (IOException)
											{
											}
											catch (SocketException)
											{
											}
											finally
											{
												try
												{
													s.Close();
												}
												catch (IOException)
												{
												}
												catch (SocketException)
												{
												}
											}
										}
									}));

			t.Start();
			Processors.Add("Git-Daemon-Client " + s.RemoteEndPoint, t);
		}