forked from I2P_Developers/i2p.i2p
stub out flags support in I2CP SMES
This commit is contained in:
@@ -28,16 +28,10 @@ public class ClientMessage {
|
||||
private Hash _destinationHash;
|
||||
private MessageId _messageId;
|
||||
private long _expiration;
|
||||
/** only for outbound messages */
|
||||
private int _flags;
|
||||
|
||||
public ClientMessage() {
|
||||
setPayload(null);
|
||||
setDestination(null);
|
||||
setFromDestination(null);
|
||||
setReceptionInfo(null);
|
||||
setSenderConfig(null);
|
||||
setDestinationHash(null);
|
||||
setMessageId(null);
|
||||
setExpiration(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,4 +95,17 @@ public class ClientMessage {
|
||||
*/
|
||||
public long getExpiration() { return _expiration; }
|
||||
public void setExpiration(long e) { _expiration = e; }
|
||||
|
||||
/**
|
||||
* Flags requested by the client that sent the message. This will only be available
|
||||
* for locally originated messages.
|
||||
*
|
||||
* @since 0.8.4
|
||||
*/
|
||||
public int getFlags() { return _flags; }
|
||||
|
||||
/**
|
||||
* @since 0.8.4
|
||||
*/
|
||||
public void setFlags(int f) { _flags = f; }
|
||||
}
|
||||
|
@@ -280,8 +280,12 @@ class ClientConnectionRunner {
|
||||
MessageId id = new MessageId();
|
||||
id.setMessageId(getNextMessageId());
|
||||
long expiration = 0;
|
||||
if (message instanceof SendMessageExpiresMessage)
|
||||
expiration = ((SendMessageExpiresMessage) message).getExpiration().getTime();
|
||||
int flags = 0;
|
||||
if (message.getType() == SendMessageExpiresMessage.MESSAGE_TYPE) {
|
||||
SendMessageExpiresMessage msg = (SendMessageExpiresMessage) message;
|
||||
expiration = msg.getExpirationTime();
|
||||
flags = msg.getFlags();
|
||||
}
|
||||
if (!_dontSendMSM)
|
||||
_acceptedPending.add(id);
|
||||
|
||||
@@ -289,16 +293,17 @@ class ClientConnectionRunner {
|
||||
_log.debug("** Receiving message [" + id.getMessageId() + "] with payload of size ["
|
||||
+ payload.getSize() + "]" + " for session [" + _sessionId.getSessionId()
|
||||
+ "]");
|
||||
long beforeDistribute = _context.clock().now();
|
||||
//long beforeDistribute = _context.clock().now();
|
||||
// the following blocks as described above
|
||||
SessionConfig cfg = _config;
|
||||
if (cfg != null)
|
||||
_manager.distributeMessage(cfg.getDestination(), dest, payload, id, expiration);
|
||||
long timeToDistribute = _context.clock().now() - beforeDistribute;
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.warn("Time to distribute in the manager to "
|
||||
+ dest.calculateHash().toBase64() + ": "
|
||||
+ timeToDistribute);
|
||||
_manager.distributeMessage(cfg.getDestination(), dest, payload, id, expiration, flags);
|
||||
// else log error?
|
||||
//long timeToDistribute = _context.clock().now() - beforeDistribute;
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.warn("Time to distribute in the manager to "
|
||||
// + dest.calculateHash().toBase64() + ": "
|
||||
// + timeToDistribute);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -193,7 +193,11 @@ class ClientManager {
|
||||
}
|
||||
}
|
||||
|
||||
void distributeMessage(Destination fromDest, Destination toDest, Payload payload, MessageId msgId, long expiration) {
|
||||
/**
|
||||
* Distribute message to a local or remote destination.
|
||||
* @param flags ignored for local
|
||||
*/
|
||||
void distributeMessage(Destination fromDest, Destination toDest, Payload payload, MessageId msgId, long expiration, int flags) {
|
||||
// check if there is a runner for it
|
||||
ClientConnectionRunner runner = getRunner(toDest);
|
||||
if (runner != null) {
|
||||
@@ -204,6 +208,7 @@ class ClientManager {
|
||||
// sender went away
|
||||
return;
|
||||
}
|
||||
// TODO can we just run this inline instead?
|
||||
_ctx.jobQueue().addJob(new DistributeLocal(toDest, runner, sender, fromDest, payload, msgId));
|
||||
} else {
|
||||
// remote. w00t
|
||||
@@ -217,22 +222,22 @@ class ClientManager {
|
||||
ClientMessage msg = new ClientMessage();
|
||||
msg.setDestination(toDest);
|
||||
msg.setPayload(payload);
|
||||
msg.setReceptionInfo(null);
|
||||
msg.setSenderConfig(runner.getConfig());
|
||||
msg.setFromDestination(runner.getConfig().getDestination());
|
||||
msg.setMessageId(msgId);
|
||||
msg.setExpiration(expiration);
|
||||
msg.setFlags(flags);
|
||||
_ctx.clientMessagePool().add(msg, true);
|
||||
}
|
||||
}
|
||||
|
||||
private class DistributeLocal extends JobImpl {
|
||||
private Destination _toDest;
|
||||
private ClientConnectionRunner _to;
|
||||
private ClientConnectionRunner _from;
|
||||
private Destination _fromDest;
|
||||
private Payload _payload;
|
||||
private MessageId _msgId;
|
||||
private final Destination _toDest;
|
||||
private final ClientConnectionRunner _to;
|
||||
private final ClientConnectionRunner _from;
|
||||
private final Destination _fromDest;
|
||||
private final Payload _payload;
|
||||
private final MessageId _msgId;
|
||||
|
||||
public DistributeLocal(Destination toDest, ClientConnectionRunner to, ClientConnectionRunner from, Destination fromDest, Payload payload, MessageId id) {
|
||||
super(_ctx);
|
||||
|
@@ -47,21 +47,21 @@ import net.i2p.util.SimpleTimer;
|
||||
*
|
||||
*/
|
||||
public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
private Log _log;
|
||||
private final Log _log;
|
||||
private long _overallExpiration;
|
||||
private ClientMessage _clientMessage;
|
||||
private MessageId _clientMessageId;
|
||||
private int _clientMessageSize;
|
||||
private Destination _from;
|
||||
private Destination _to;
|
||||
private String _toString;
|
||||
private final MessageId _clientMessageId;
|
||||
private final int _clientMessageSize;
|
||||
private final Destination _from;
|
||||
private final Destination _to;
|
||||
private final String _toString;
|
||||
/** target destination's leaseSet, if known */
|
||||
private LeaseSet _leaseSet;
|
||||
/** Actual lease the message is being routed through */
|
||||
private Lease _lease;
|
||||
private PayloadGarlicConfig _clove;
|
||||
private long _cloveId;
|
||||
private long _start;
|
||||
private final long _start;
|
||||
private boolean _finished;
|
||||
private long _leaseSetLookupBegin;
|
||||
private TunnelInfo _outTunnel;
|
||||
|
Reference in New Issue
Block a user