public void AddConnection(TorrentConnection connection, TorrentManager manager) { string remoteId = String.Empty; LoggingService.LogDebug("AddConnection(): Start"); if (!connection.IsIncoming) { // Send my identity. // XXX: This absolutely needs to be signed. connection.Transport.SendMessage(System.Text.Encoding.ASCII.GetBytes(Core.MyNodeID)); // Get other end's identity. byte[] message = connection.Transport.ReceiveMessage(); remoteId = System.Text.Encoding.ASCII.GetString(message); } else { // Get other end's identity. byte[] message = connection.Transport.ReceiveMessage(); remoteId = System.Text.Encoding.ASCII.GetString(message); // Send my identity. // XXX: This absolutely needs to be signed. connection.Transport.SendMessage(System.Text.Encoding.ASCII.GetBytes(Core.MyNodeID)); } LoggingService.LogDebug("Pushing connection to engine: {0} - {1}", connection.IsIncoming ? "Incoming" : "Outgoing", ((Meshwork.Transport.TcpTransport)connection.Transport).RemoteEndPoint.ToString()); Peer p = new Peer("", new Uri(String.Format("meshwork:{0}", remoteId)), EncryptionTypes.PlainText); RaiseConnectionReceived(p, connection, manager); LoggingService.LogDebug("AddConnection(): End"); }
public void HandleTransport(ITransport transport, object state = null) { var connection = new TorrentConnection(transport); this.loggingService.LogDebug("Transfer handled connection: {0}", connection.IsIncoming ? "Incoming" : "Outgoing"); this.listener.AddConnection(connection, state != null ? (TorrentManager)state : null); }
public void AddConnection(TorrentConnection connection, TorrentManager manager) { string remoteId = String.Empty; Core.LoggingService.LogDebug("AddConnection(): Start"); if (!connection.IsIncoming) { // Send my identity. // XXX: This absolutely needs to be signed. connection.Transport.SendMessage(System.Text.Encoding.ASCII.GetBytes(Core.MyNodeID)); // Get other end's identity. byte[] message = connection.Transport.ReceiveMessage(); remoteId = System.Text.Encoding.ASCII.GetString(message); } else { // Get other end's identity. byte[] message = connection.Transport.ReceiveMessage(); remoteId = System.Text.Encoding.ASCII.GetString(message); // Send my identity. // XXX: This absolutely needs to be signed. connection.Transport.SendMessage(System.Text.Encoding.ASCII.GetBytes(Core.MyNodeID)); } Core.LoggingService.LogDebug("Pushing connection to engine: {0} - {1}", connection.IsIncoming ? "Incoming" : "Outgoing", ((Meshwork.Transport.TcpTransport)connection.Transport).RemoteEndPoint.ToString()); Peer p = new Peer("", new Uri(String.Format("meshwork:{0}", remoteId)), EncryptionTypes.PlainText); RaiseConnectionReceived(p, connection, manager); Core.LoggingService.LogDebug("AddConnection(): End"); }
public void AddConnection(TorrentConnection connection) { LoggingService.LogDebug("Incoming connection: {0}", connection.IsIncoming ? "Incoming" : "Outgoing"); listener.AddConnection(connection, null); }
internal void NewIncomingConnection(ITransport transport) { BitTorrent.TorrentConnection c = new BitTorrent.TorrentConnection(transport); ((BitTorrent.BitTorrentFileTransferProvider)provider).AddConnection(c); }