I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 38b0927d authored by zzz's avatar zzz
Browse files

* I2CP: MessageStatus cleanup

parent 715bde5e
No related branches found
No related tags found
No related merge requests found
...@@ -12,22 +12,24 @@ import net.i2p.data.i2cp.MessageStatusMessage; ...@@ -12,22 +12,24 @@ import net.i2p.data.i2cp.MessageStatusMessage;
import net.i2p.util.Log; import net.i2p.util.Log;
/** /**
* Contains the state of a payload message being sent to a peer * Contains the state of a payload message being sent to a peer.
* *
* This is mostly unused. See sendNoEffort vs. sendBestEffort in I2PSessionImpl2.
* TODO delete altogether? This is really bad.
*/ */
class MessageState { class MessageState {
private I2PAppContext _context; private final I2PAppContext _context;
private final static Log _log = new Log(MessageState.class); private final Log _log;
private long _nonce; private final long _nonce;
private String _prefix; private final String _prefix;
private MessageId _id; private MessageId _id;
private final Set _receivedStatus; private final Set<Integer> _receivedStatus;
private SessionKey _key; private SessionKey _key;
private SessionKey _newKey; private SessionKey _newKey;
private Set _tags; private Set _tags;
private Destination _to; private Destination _to;
private boolean _cancelled; private boolean _cancelled;
private long _created; private final long _created;
private static long __stateId = 0; private static long __stateId = 0;
private long _stateId; private long _stateId;
...@@ -35,6 +37,7 @@ class MessageState { ...@@ -35,6 +37,7 @@ class MessageState {
public MessageState(I2PAppContext ctx, long nonce, String prefix) { public MessageState(I2PAppContext ctx, long nonce, String prefix) {
_stateId = ++__stateId; _stateId = ++__stateId;
_context = ctx; _context = ctx;
_log = ctx.logManager().getLog(MessageState.class);
_nonce = nonce; _nonce = nonce;
_prefix = prefix + "[" + _stateId + "]: "; _prefix = prefix + "[" + _stateId + "]: ";
_receivedStatus = new HashSet(); _receivedStatus = new HashSet();
...@@ -61,28 +64,34 @@ class MessageState { ...@@ -61,28 +64,34 @@ class MessageState {
return _nonce; return _nonce;
} }
/** @deprecated unused */
public void setKey(SessionKey key) { public void setKey(SessionKey key) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug(_prefix + "Setting key [" + _key + "] to [" + key + "]"); _log.debug(_prefix + "Setting key [" + _key + "] to [" + key + "]");
_key = key; _key = key;
} }
/** @deprecated unused */
public SessionKey getKey() { public SessionKey getKey() {
return _key; return _key;
} }
/** @deprecated unused */
public void setNewKey(SessionKey key) { public void setNewKey(SessionKey key) {
_newKey = key; _newKey = key;
} }
/** @deprecated unused */
public SessionKey getNewKey() { public SessionKey getNewKey() {
return _newKey; return _newKey;
} }
/** @deprecated unused */
public void setTags(Set tags) { public void setTags(Set tags) {
_tags = tags; _tags = tags;
} }
/** @deprecated unused */
public Set getTags() { public Set getTags() {
return _tags; return _tags;
} }
...@@ -91,6 +100,7 @@ class MessageState { ...@@ -91,6 +100,7 @@ class MessageState {
_to = dest; _to = dest;
} }
/** @deprecated unused */
public Destination getTo() { public Destination getTo() {
return _to; return _to;
} }
...@@ -256,7 +266,7 @@ class MessageState { ...@@ -256,7 +266,7 @@ class MessageState {
return rv; return rv;
} }
/** true if the given status (or an equivilant) was received */ /** #return true if the given status (or an equivalent) was received */
public boolean received(int status) { public boolean received(int status) {
synchronized (_receivedStatus) { synchronized (_receivedStatus) {
return locked_isSuccess(status); return locked_isSuccess(status);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment