public class MessageHistory extends Object
This is always instantiated in context and 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.
| Modifier and Type | Field and Description |
|---|---|
static String | DEFAULT_MESSAGE_HISTORY_FILENAMEDefault file name for the message history log. |
static String | PROP_KEEP_MESSAGE_HISTORYConfig property determining whether we want to debug with the message history - default false |
static String | PROP_MESSAGE_HISTORY_FILENAMEConfig property determining where we want to log the message history, if we're keeping one |
| Constructor and Description |
|---|
MessageHistory(RouterContext context)Message history for the given context. |
| Modifier and Type | Method and Description |
|---|---|
void | banlist(Hash peer,
String reason)We banlisted the peer |
void | droppedFragmentedMessage(long messageId,
String status)Note that a fragmented message was dropped. |
void | droppedInboundMessage(long messageId,
Hash from,
String info)Note that an inbound message was dropped. |
void | droppedOtherMessage(I2NPMessage message,
Hash from)We received another message we weren't waiting for and don't know how to handle |
void | droppedTunnelDataMessageUnknown(long msgId,
long tunnelId)Note that a data message for an unknown tunnel was dropped. |
void | droppedTunnelGatewayMessageUnknown(long msgId,
long tunnelId)Note that a gateway message for an unknown tunnel was dropped. |
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 |
void | fragmentMessage(long messageId,
int numFragments,
int totalLength,
List<Long> messageIds,
Object tunnel,
String msg)Note that a message was split into fragments. |
void | fragmentMessage(long messageId,
int numFragments,
int totalLength,
List<Long> messageIds,
String msg)Note that a message was split into fragments. |
boolean | getDoLog()Whether logging is enabled. |
(package private) String | getFilename()History file name. |
void | initialize(boolean forceReinitialize)Initialize the message history according to the router's configuration. |
void | messageProcessingError(long messageId,
String messageType,
String error)There was an error processing the given message that was received |
void | receiveMessage(String messageType,
long messageId,
long expiration,
boolean isValid)Note that we just received a message with no known origin. |
void | receiveMessage(String messageType,
long messageId,
long expiration,
Hash from,
boolean isValid)Note that we just received a message from the peer. |
void | receivePayloadMessage(long messageId)Receive a payload message to distribute to a client |
void | receiveTunnelFragment(long messageId,
int fragmentId,
Object status)Note that we received a fragment of a tunneled message. |
void | receiveTunnelFragmentComplete(long messageId)Note that all fragments of a tunneled message were received. |
void | replyTimedOut(OutNetMessage sentMessage)The message wanted a reply but no reply came in the time expected |
void | sendMessage(String messageType,
long messageId,
long expiration,
Hash peer,
boolean sentOk,
String info)We just sent a message to the peer |
void | sendPayloadMessage(long messageId,
boolean successfullySent,
long timeToSend)Note that the sending of a payload message completed (successfully or as a failure) |
void | shutdown()Shutdown the message history. |
void | tunnelDispatched(long messageId,
long tunnelId,
long toTunnel,
Hash toPeer,
String type)Note that a message was dispatched to a tunnel. |
void | tunnelDispatched(long messageId,
long innerMessageId,
long tunnelId,
String type)Note that a message was dispatched to a tunnel. |
void | tunnelDispatched(long messageId,
long tunnelId,
String type)Note that a message was dispatched to a tunnel. |
void | tunnelDispatched(String info)Note that a message was dispatched to a tunnel. |
void | tunnelFailed(TunnelId tunnel)The local router has detected a failure in the given tunnel |
void | tunnelJoined(String state,
HopConfig tunnel)The local router has joined the given tunnel operating in the given state. |
void | tunnelJoined(String state,
TunnelInfo tunnel)The local router has joined the given tunnel operating in the given state. |
void | tunnelParticipantRejected(Hash peer,
String msg)Note that a router rejected our request to participate in a tunnel. |
void | tunnelRejected(Hash peer,
TunnelId tunnel,
Hash replyThrough,
String reason)The peer did not accept the tunnel join for the given reason |
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). |
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 |
void | unbanlist(Hash peer)We unbanlisted the peer |
void | wrap(String bodyMessageType,
long bodyMessageId,
String containerMessageType,
long containerMessageId)Note that we're wrapping the given message within another message (via tunnel/garlic) |
public static final String DEFAULT_MESSAGE_HISTORY_FILENAME
public static final String PROP_KEEP_MESSAGE_HISTORY
public static final String PROP_MESSAGE_HISTORY_FILENAME
public MessageHistory(RouterContext context)
context - the router contextpublic void droppedFragmentedMessage(long messageId,
String status)messageId - message ID droppedstatus - the reason it was droppedpublic void droppedInboundMessage(long messageId,
Hash from,
String info)messageId - message ID droppedfrom - peer that sent the message (if known)info - the reason the message was droppedpublic void droppedOtherMessage(I2NPMessage message, Hash from)
public void droppedTunnelDataMessageUnknown(long msgId,
long tunnelId)msgId - message ID droppedtunnelId - tunnel ID the message was forpublic void droppedTunnelGatewayMessageUnknown(long msgId,
long tunnelId)msgId - message ID droppedtunnelId - tunnel ID the message was forpublic void droppedTunnelMessage(TunnelId id, long msgId, Date expiration, Hash from)
id - tunnel ID we received a message forfrom - peer that sent us this message (if known)public void fragmentMessage(long messageId,
int numFragments,
int totalLength,
List<Long> messageIds,
Object tunnel,
String msg)messageId - message ID fragmentednumFragments - number of fragmentstotalLength - total length of the messagemessageIds - the fragment message IDstunnel - tunnel the fragments were sent onmsg - additional infopublic void fragmentMessage(long messageId,
int numFragments,
int totalLength,
List<Long> messageIds,
String msg)messageId - message ID fragmentednumFragments - number of fragmentstotalLength - total length of the messagemessageIds - the fragment message IDsmsg - additional infopublic boolean getDoLog()
String getFilename()
public void initialize(boolean forceReinitialize)
forceReinitialize - whether to force reinitpublic void messageProcessingError(long messageId,
String messageType,
String error)messageId - message receivedmessageType - type of message receivederror - error message related to the processing of the messagepublic void receiveMessage(String messageType, long messageId, long expiration, boolean isValid)
messageType - class name for the message object (e.g. DatabaseFindNearestMessage, TunnelMessage, etc)messageId - the unique message id of the message receivedexpiration - the expiration for the message receivedisValid - whether the message is valid (non duplicates, etc)public void receiveMessage(String messageType, long messageId, long expiration, Hash from, boolean isValid)
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 receivedfrom - router that the message was sent from (or null if we don't know)isValid - whether the message is valid (non duplicates, etc)public void receivePayloadMessage(long messageId)
public void receiveTunnelFragment(long messageId,
int fragmentId,
Object status)messageId - message ID the fragment belongs tofragmentId - fragment indexstatus - status object for the fragmentpublic void receiveTunnelFragmentComplete(long messageId)
messageId - message ID that completedpublic void replyTimedOut(OutNetMessage sentMessage)
sentMessage - message sent that didn't receive a replypublic void sendMessage(String messageType, long messageId, long expiration, Hash peer, boolean sentOk, String info)
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 sentpeer - router that the message was sent tosentOk - whether the message was sent successfullypublic void sendPayloadMessage(long messageId,
boolean successfullySent,
long timeToSend)messageId - message that the payload message was sent insuccessfullySent - whether the message was delivered to the peer successfullytimeToSend - how long it took to send the messagepublic void shutdown()
public void tunnelDispatched(long messageId,
long tunnelId,
long toTunnel,
Hash toPeer,
String type)messageId - the message IDtunnelId - the tunnel IDtoTunnel - the tunneltoPeer - the peertype - the typepublic void tunnelDispatched(long messageId,
long innerMessageId,
long tunnelId,
String type)messageId - the message IDinnerMessageId - the inner message IDtunnelId - the tunnel IDtype - the typepublic void tunnelDispatched(long messageId,
long tunnelId,
String type)messageId - the message IDtunnelId - the tunnel IDtype - the typepublic void tunnelDispatched(String info)
info - the infopublic void tunnelFailed(TunnelId tunnel)
tunnel - tunnel failedpublic void tunnelJoined(String state, HopConfig tunnel)
state - {"free inbound", "allocated inbound", "inactive inbound", "outbound", "participant", "pending"}tunnel - tunnel joinedpublic void tunnelJoined(String state, TunnelInfo tunnel)
state - {"free inbound", "allocated inbound", "inactive inbound", "outbound", "participant", "pending"}tunnel - tunnel joinedpublic void tunnelParticipantRejected(Hash peer, String msg)
peer - the peermsg - the messagepublic void tunnelRejected(Hash peer, TunnelId tunnel, Hash replyThrough, String reason)
peer - the peertunnel - the tunnelreplyThrough - the reply-through routerreason - the reasonpublic void tunnelRequestTimedOut(Hash peer, TunnelId tunnel)
public void tunnelValid(TunnelInfo tunnel, long timeToTest)
tunnel - tunnel in questiontimeToTest - milliseconds to verify the tunnelpublic void unbanlist(Hash peer)
public void wrap(String bodyMessageType, long bodyMessageId, String containerMessageType, long containerMessageId)
bodyMessageType - class name for the message contained (e.g. DatabaseFindNearestMessage, DataMessage, etc)bodyMessageId - the unique message id of the messagecontainerMessageType - class name for the message containing the body message (e.g. TunnelMessage, GarlicMessage, etc)containerMessageId - the unique message id of the message