internal TagsTransferWindow(DestinationSession session, OutboundTunnelSelector tunnelsel) { Window = new TimeWindowDictionary <uint, GarlicCreationInfo>(GarlicResendTimeLimit); OutstandingMessageIds = new TimeWindowDictionary <uint, GarlicCreationInfo>(GarlicTimeBetweenResends * 10); Resend = new PeriodicAction(GarlicTimeBetweenResends / 4); Session = session; TunnelSelector = tunnelsel; TunnelProvider.DeliveryStatusReceived += new Action <DeliveryStatusMessage>(TunnelProvider_DeliveryStatusReceived); InboundTunnel.DeliveryStatusReceived += new Action <DeliveryStatusMessage>(InboundTunnel_DeliveryStatusReceived); }
public DestinationSession this[I2PKeysAndCert dest] { get { lock ( Sessions ) { DestinationSession result; if (!Sessions.TryGetValue(dest.IdentHash, out result)) { result = new DestinationSession(dest, OutTunnelSelector, InTunnelSelector); Sessions[dest.IdentHash] = result; } return(result); } } }
/* * public GarlicCreationInfo GenerateGarlicMessage( I2PKeysAndCert dest, Garlic msg ) * { * DestinationSession session; * * lock ( Sessions ) * { * if ( !Sessions.TryGetValue( dest, out session ) ) * { * session = new DestinationSession( dest, OutTunnelSelector, InTunnelSelector ); * Sessions[dest] = session; * } * } * * return session.Encrypt( msg, I2NPHeader.GenerateMessageId() ); * } * * public GarlicCreationInfo CreateMessage( I2PKeysAndCert dest, params GarlicCloveDelivery[] messages ) * { * return GenerateGarlicMessage( dest, Garlic.Create( messages ) ); * } * * public GarlicCreationInfo CreateMessage( I2PKeysAndCert dest, I2PDate expiration, params GarlicCloveDelivery[] messages ) * { * return GenerateGarlicMessage( dest, Garlic.Create( expiration, messages ) ); * } */ internal GarlicCreationInfo Send(I2PKeysAndCert dest, bool explack, params GarlicCloveDelivery[] messages) { DestinationSession session = this[dest]; return(session.Send(explack, messages)); }