Package net.i2p.router
Class MessageHistory
- java.lang.Object
- 
- net.i2p.router.MessageHistory
 
- 
 public class MessageHistory extends Object Simply act as a pen register of messages sent in and out of the router. This will be pulled out later on, but is useful now for debugging. (with clock synchronization, this will generate a log that can be used to analyze the entire network, if everyone provides their logs honestly) This is always instantiated in the context and the WriteJob runs every minute, (except on Android, we don't set up the WriteJob) but unless router.keepHistory=true it does nothing. It generates a LARGE log file.
- 
- 
Field SummaryFields Modifier and Type Field Description static StringDEFAULT_MESSAGE_HISTORY_FILENAMEstatic StringPROP_KEEP_MESSAGE_HISTORYconfig property determining whether we want to debug with the message history - default falsestatic StringPROP_MESSAGE_HISTORY_FILENAMEconfig property determining where we want to log the message history, if we're keeping one
 - 
Constructor SummaryConstructors Constructor Description MessageHistory(RouterContext context)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbanlist(Hash peer, String reason)We banlisted the peervoiddroppedFragmentedMessage(long messageId, String status)voiddroppedInboundMessage(long messageId, Hash from, String info)voiddroppedOtherMessage(I2NPMessage message, Hash from)We received another message we weren't waiting for and don't know how to handlevoiddroppedTunnelDataMessageUnknown(long msgId, long tunnelId)voiddroppedTunnelGatewayMessageUnknown(long msgId, long tunnelId)voiddroppedTunnelMessage(TunnelId id, long msgId, Date expiration, Hash from)We don't know about the given tunnel, so we are dropping a message sent to us by the given routervoidfragmentMessage(long messageId, int numFragments, int totalLength, List<Long> messageIds, Object tunnel, String msg)voidfragmentMessage(long messageId, int numFragments, int totalLength, List<Long> messageIds, String msg)booleangetDoLog()(package private) StringgetFilename()voidinitialize(boolean forceReinitialize)Initialize the message history according to the router's configuration.voidmessageProcessingError(long messageId, String messageType, String error)There was an error processing the given message that was receivedvoidreceiveMessage(String messageType, long messageId, long expiration, boolean isValid)voidreceiveMessage(String messageType, long messageId, long expiration, Hash from, boolean isValid)We just received a message from the peervoidreceivePayloadMessage(long messageId)Receive a payload message to distribute to a clientvoidreceiveTunnelFragment(long messageId, int fragmentId, Object status)voidreceiveTunnelFragmentComplete(long messageId)voidreplyTimedOut(OutNetMessage sentMessage)The message wanted a reply but no reply came in the time expectedvoidsendMessage(String messageType, long messageId, long expiration, Hash peer, boolean sentOk, String info)We just sent a message to the peervoidsendPayloadMessage(long messageId, boolean successfullySent, long timeToSend)Note that the sending of a payload message completed (successfully or as a failure)(package private) voidsetPauseFlushes(boolean doPause)Deprecated.unusedvoidshutdown()voidtunnelDispatched(long messageId, long innerMessageId, long tunnelId, String type)voidtunnelDispatched(long messageId, long tunnelId, long toTunnel, Hash toPeer, String type)voidtunnelDispatched(long messageId, long tunnelId, String type)voidtunnelDispatched(String info)voidtunnelFailed(TunnelId tunnel)The local router has detected a failure in the given tunnelvoidtunnelJoined(String state, HopConfig tunnel)The local router has joined the given tunnel operating in the given state.voidtunnelJoined(String state, TunnelInfo tunnel)The local router has joined the given tunnel operating in the given state.voidtunnelParticipantRejected(Hash peer, String msg)voidtunnelRejected(Hash peer, TunnelId tunnel, Hash replyThrough, String reason)The peer did not accept the tunnel join for the given reasonvoidtunnelRequestTimedOut(Hash peer, TunnelId tunnel)The peer did not accept the tunnel join for the given reason (this may be because of a timeout or an explicit refusal).voidtunnelValid(TunnelInfo tunnel, long timeToTest)Note that we have reason to believe that the given tunnel is valid, since we could do something through it in the given amount of timevoidunbanlist(Hash peer)We unbanlisted the peervoidwrap(String bodyMessageType, long bodyMessageId, String containerMessageType, long containerMessageId)Note that we're wrapping the given message within another message (via tunnel/garlic)
 
- 
- 
- 
Field Detail- 
PROP_KEEP_MESSAGE_HISTORYpublic static final String PROP_KEEP_MESSAGE_HISTORY config property determining whether we want to debug with the message history - default false- See Also:
- Constant Field Values
 
 - 
PROP_MESSAGE_HISTORY_FILENAMEpublic static final String PROP_MESSAGE_HISTORY_FILENAME config property determining where we want to log the message history, if we're keeping one- See Also:
- Constant Field Values
 
 - 
DEFAULT_MESSAGE_HISTORY_FILENAMEpublic static final String DEFAULT_MESSAGE_HISTORY_FILENAME - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
MessageHistorypublic MessageHistory(RouterContext context) 
 
- 
 - 
Method Detail- 
shutdownpublic void shutdown() - Since:
- 0.8.12
 
 - 
getDoLogpublic boolean getDoLog() 
 - 
setPauseFlushes@Deprecated void setPauseFlushes(boolean doPause) Deprecated.unused
 - 
getFilenameString getFilename() 
 - 
initializepublic void initialize(boolean forceReinitialize) Initialize the message history according to the router's configuration. Call this whenever the router identity changes.
 - 
tunnelJoinedpublic void tunnelJoined(String state, TunnelInfo tunnel) The local router has joined the given tunnel operating in the given state.- Parameters:
- state- {"free inbound", "allocated inbound", "inactive inbound", "outbound", "participant", "pending"}
- tunnel- tunnel joined
 
 - 
tunnelJoinedpublic void tunnelJoined(String state, HopConfig tunnel) The local router has joined the given tunnel operating in the given state.- Parameters:
- state- {"free inbound", "allocated inbound", "inactive inbound", "outbound", "participant", "pending"}
- tunnel- tunnel joined
 
 - 
tunnelDispatchedpublic void tunnelDispatched(String info) 
 - 
tunnelDispatchedpublic void tunnelDispatched(long messageId, long tunnelId, String type)
 - 
tunnelDispatchedpublic void tunnelDispatched(long messageId, long tunnelId, long toTunnel, Hash toPeer, String type)
 - 
tunnelDispatchedpublic void tunnelDispatched(long messageId, long innerMessageId, long tunnelId, String type)
 - 
tunnelFailedpublic void tunnelFailed(TunnelId tunnel) The local router has detected a failure in the given tunnel- Parameters:
- tunnel- tunnel failed
 
 - 
tunnelValidpublic void tunnelValid(TunnelInfo tunnel, long timeToTest) Note that we have reason to believe that the given tunnel is valid, since we could do something through it in the given amount of time- Parameters:
- tunnel- tunnel in question
- timeToTest- milliseconds to verify the tunnel
 
 - 
tunnelRejectedpublic void tunnelRejected(Hash peer, TunnelId tunnel, Hash replyThrough, String reason) The peer did not accept the tunnel join for the given reason
 - 
tunnelRequestTimedOutpublic void tunnelRequestTimedOut(Hash peer, TunnelId tunnel) The peer did not accept the tunnel join for the given reason (this may be because of a timeout or an explicit refusal).
 - 
droppedTunnelMessagepublic void droppedTunnelMessage(TunnelId id, long msgId, Date expiration, Hash from) We don't know about the given tunnel, so we are dropping a message sent to us by the given router- Parameters:
- id- tunnel ID we received a message for
- from- peer that sent us this message (if known)
 
 - 
droppedOtherMessagepublic void droppedOtherMessage(I2NPMessage message, Hash from) We received another message we weren't waiting for and don't know how to handle
 - 
replyTimedOutpublic void replyTimedOut(OutNetMessage sentMessage) The message wanted a reply but no reply came in the time expected- Parameters:
- sentMessage- message sent that didn't receive a reply
 
 - 
messageProcessingErrorpublic void messageProcessingError(long messageId, String messageType, String error)There was an error processing the given message that was received- Parameters:
- messageId- message received
- messageType- type of message received
- error- error message related to the processing of the message
 
 - 
unbanlistpublic void unbanlist(Hash peer) We unbanlisted the peer
 - 
sendMessagepublic void sendMessage(String messageType, long messageId, long expiration, Hash peer, boolean sentOk, String info) We just sent a message to the peer- Parameters:
- messageType- class name for the message object (e.g. DatabaseFindNearestMessage, TunnelMessage, etc)
- messageId- the unique message id of the message being sent (not including any tunnel or garlic wrapped message ids)
- expiration- the expiration for the message sent
- peer- router that the message was sent to
- sentOk- whether the message was sent successfully
 
 - 
receiveMessagepublic void receiveMessage(String messageType, long messageId, long expiration, Hash from, boolean isValid) We just received a message from the peer- Parameters:
- messageType- class name for the message object (e.g. DatabaseFindNearestMessage, TunnelMessage, etc)
- messageId- the unique message id of the message received (not including any tunnel or garlic wrapped message ids)
- expiration- the expiration for the message received
- from- router that the message was sent from (or null if we don't know)
- isValid- whether the message is valid (non duplicates, etc)
 
 - 
receiveMessagepublic void receiveMessage(String messageType, long messageId, long expiration, boolean isValid) 
 - 
wrappublic void wrap(String bodyMessageType, long bodyMessageId, String containerMessageType, long containerMessageId) Note that we're wrapping the given message within another message (via tunnel/garlic)- Parameters:
- bodyMessageType- class name for the message contained (e.g. DatabaseFindNearestMessage, DataMessage, etc)
- bodyMessageId- the unique message id of the message
- containerMessageType- class name for the message containing the body message (e.g. TunnelMessage, GarlicMessage, etc)
- containerMessageId- the unique message id of the message
 
 - 
receivePayloadMessagepublic void receivePayloadMessage(long messageId) Receive a payload message to distribute to a client
 - 
sendPayloadMessagepublic void sendPayloadMessage(long messageId, boolean successfullySent, long timeToSend)Note that the sending of a payload message completed (successfully or as a failure)- Parameters:
- messageId- message that the payload message was sent in
- successfullySent- whether the message was delivered to the peer successfully
- timeToSend- how long it took to send the message
 
 - 
receiveTunnelFragmentpublic void receiveTunnelFragment(long messageId, int fragmentId, Object status)
 - 
receiveTunnelFragmentCompletepublic void receiveTunnelFragmentComplete(long messageId) 
 - 
droppedFragmentedMessagepublic void droppedFragmentedMessage(long messageId, String status)
 - 
fragmentMessagepublic void fragmentMessage(long messageId, int numFragments, int totalLength, List<Long> messageIds, String msg)
 - 
fragmentMessagepublic void fragmentMessage(long messageId, int numFragments, int totalLength, List<Long> messageIds, Object tunnel, String msg)
 - 
droppedTunnelDataMessageUnknownpublic void droppedTunnelDataMessageUnknown(long msgId, long tunnelId)
 - 
droppedTunnelGatewayMessageUnknownpublic void droppedTunnelGatewayMessageUnknown(long msgId, long tunnelId)
 
- 
 
-