Exemple #1
0
 public void setMessage(I2NPMessage msg) {
   _message = msg;
   if (msg != null) {
     _messageTypeId = msg.getType();
     _messageId = msg.getUniqueId();
     _messageSize = _message.getMessageSize();
   }
 }
Exemple #2
0
 /** We received another message we weren't waiting for and don't know how to handle */
 public void droppedOtherMessage(I2NPMessage message, Hash from) {
   if (!_doLog) return;
   if (message == null) return;
   StringBuilder buf = new StringBuilder(512);
   buf.append(getPrefix());
   buf.append("dropped [")
       .append(message.getClass().getName())
       .append("] ")
       .append(message.getUniqueId());
   buf.append(" [").append(message.toString()).append("] from [");
   if (from != null) buf.append(from.toBase64());
   else buf.append("unknown");
   buf.append("] expiring in ")
       .append(message.getMessageExpiration() - _context.clock().now())
       .append("ms");
   addEntry(buf.toString());
 }
Exemple #3
0
 public int getMessageData(byte outBuffer[]) {
   if (_message == null) {
     return -1;
   } else {
     int len = _message.toByteArray(outBuffer);
     _messageSize = len;
     return len;
   }
 }
Exemple #4
0
 /**
  * We've done what we need to do with the data from this message, though we may keep the object
  * around for a while to use its ID, jobs, etc.
  */
 public void discardData() {
   if ((_message != null) && (_messageSize <= 0)) _messageSize = _message.getMessageSize();
   if (_log.shouldLog(Log.DEBUG)) {
     long timeToDiscard = _context.clock().now() - _created;
     _log.debug(
         "Discard "
             + _messageSize
             + "byte "
             + getMessageType()
             + " message after "
             + timeToDiscard);
   }
   _message = null;
   // _context.statManager().addRateData("outNetMessage.timeToDiscard", timeToDiscard,
   // timeToDiscard);
   // _context.messageStateMonitor().outboundMessageDiscarded();
 }
Exemple #5
0
 public long getMessageSize() {
   if (_messageSize <= 0) {
     _messageSize = _message.getMessageSize();
   }
   return _messageSize;
 }
Exemple #6
0
 /**
  * For debugging only.
  *
  * @return the simple class name
  */
 public String getMessageType() {
   I2NPMessage msg = _message;
   return msg != null ? msg.getClass().getSimpleName() : "null";
 }