Package net.i2p.router.transport.udp
Class OutboundMessageFragments
- java.lang.Object
- 
- net.i2p.router.transport.udp.OutboundMessageFragments
 
- 
 class OutboundMessageFragments extends Object Coordinate the outbound fragments and select the next one to be built. This pool contains messages we are actively trying to send, essentially doing a round robin across each message to send one fragment, as implemented ingetNextVolley(). This also honors per-peer throttling, taking note of each peer's allocations. If a message has each of its fragments sent more than a certain number of times, it is failed out. In addition, this instance also receives notification of message ACKs from theInboundMessageFragments, signaling that we can stop sending a message.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceOutboundMessageFragments.ActiveThrottlethrottle
 - 
Field SummaryFields Modifier and Type Field Description (package private) static intMAX_VOLLEYSif we can handle more messages explicitly, set this to true
 - 
Constructor SummaryConstructors Constructor Description OutboundMessageFragments(RouterContext ctx, UDPTransport transport, OutboundMessageFragments.ActiveThrottle throttle)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(List<OutboundMessageState> states, PeerState peer)Short circuit the OutNetMessage, letting us send multiple messages reliably and efficiently.voidadd(OutNetMessage msg)Add a new message to the active poolvoidadd(OutboundMessageState state, PeerState peer)Short circuit the OutNetMessage, letting us send the establish complete message reliably.voidadd(PeerState peer, int size)Add the peer to the list of peers wanting to transmit something.(package private) voiddropPeer(PeerState peer)List<UDPPacket>getNextVolley()Fetch all the packets for a message volley, blocking until there is a message which can be fully transmitted (or the transport is shut down).(package private) voidnudge()Wakes up the packet pusher thread.voidshutdown()voidstartup()booleanwaitForMoreAllowed()Block until we allow more messages to be admitted to the active pool.
 
- 
- 
- 
Field Detail- 
MAX_VOLLEYSstatic final int MAX_VOLLEYS if we can handle more messages explicitly, set this to true- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
OutboundMessageFragmentspublic OutboundMessageFragments(RouterContext ctx, UDPTransport transport, OutboundMessageFragments.ActiveThrottle throttle) 
 
- 
 - 
Method Detail- 
startuppublic void startup() 
 - 
shutdownpublic void shutdown() 
 - 
dropPeervoid dropPeer(PeerState peer) 
 - 
waitForMoreAllowedpublic boolean waitForMoreAllowed() Block until we allow more messages to be admitted to the active pool. This is called by theOutboundRefiller- Returns:
- true if more messages are allowed
 
 - 
addpublic void add(OutNetMessage msg) Add a new message to the active pool
 - 
addpublic void add(OutboundMessageState state, PeerState peer) Short circuit the OutNetMessage, letting us send the establish complete message reliably. If you have multiple messages, use the list variant, so the messages may be bundled efficiently.
 - 
addpublic void add(List<OutboundMessageState> states, PeerState peer) Short circuit the OutNetMessage, letting us send multiple messages reliably and efficiently.- Since:
- 0.9.24
 
 - 
addpublic void add(PeerState peer, int size) Add the peer to the list of peers wanting to transmit something. This wakes up the packet pusher if it is sleeping. Avoid synchronization where possible. There are small chances of races. There are larger chances of adding the PeerState "behind" where the iterator is now... but these issues are the same as before concurrentification.- Parameters:
- size- the minimum size we can send, or 0 to always notify
- Since:
- 0.8.9
 
 - 
getNextVolleypublic List<UDPPacket> getNextVolley() Fetch all the packets for a message volley, blocking until there is a message which can be fully transmitted (or the transport is shut down). NOT thread-safe. Called by the PacketPusher thread only.- Returns:
- null only on shutdown
 
 - 
nudgevoid nudge() Wakes up the packet pusher thread.- Since:
- 0.9.48
 
 
- 
 
-