forked from I2P_Developers/i2p.i2p
dont throw when setting to the same value
This commit is contained in:
@@ -151,26 +151,32 @@ class Packet {
|
|||||||
public Packet() { }
|
public Packet() { }
|
||||||
|
|
||||||
private boolean _sendStreamIdSet = false;
|
private boolean _sendStreamIdSet = false;
|
||||||
|
|
||||||
/** what stream do we send data to the peer on?
|
/** what stream do we send data to the peer on?
|
||||||
* @return stream ID we use to send data
|
* @return stream ID we use to send data
|
||||||
*/
|
*/
|
||||||
public long getSendStreamId() { return _sendStreamId; }
|
public long getSendStreamId() { return _sendStreamId; }
|
||||||
|
|
||||||
public void setSendStreamId(long id) {
|
public void setSendStreamId(long id) {
|
||||||
if ( (_sendStreamIdSet) && (_sendStreamId > 0) )
|
// allow resetting to the same id (race)
|
||||||
|
if ( (_sendStreamIdSet) && (_sendStreamId > 0) && _sendStreamId != id)
|
||||||
throw new RuntimeException("Send stream ID already set [" + _sendStreamId + ", " + id + "]");
|
throw new RuntimeException("Send stream ID already set [" + _sendStreamId + ", " + id + "]");
|
||||||
_sendStreamIdSet = true;
|
_sendStreamIdSet = true;
|
||||||
_sendStreamId = id;
|
_sendStreamId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean _receiveStreamIdSet = false;
|
private boolean _receiveStreamIdSet = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream the replies should be sent on. this should be 0 if the
|
* stream the replies should be sent on. this should be 0 if the
|
||||||
* connection is still being built.
|
* connection is still being built.
|
||||||
* @return stream ID we use to get data, zero if the connection is still being built.
|
* @return stream ID we use to get data, zero if the connection is still being built.
|
||||||
*/
|
*/
|
||||||
public long getReceiveStreamId() { return _receiveStreamId; }
|
public long getReceiveStreamId() { return _receiveStreamId; }
|
||||||
|
|
||||||
public void setReceiveStreamId(long id) {
|
public void setReceiveStreamId(long id) {
|
||||||
if ( (_receiveStreamIdSet) && (_receiveStreamId > 0) )
|
// allow resetting to the same id (race)
|
||||||
|
if ( (_receiveStreamIdSet) && (_receiveStreamId > 0) && _receiveStreamId != id)
|
||||||
throw new RuntimeException("Receive stream ID already set [" + _receiveStreamId + ", " + id + "]");
|
throw new RuntimeException("Receive stream ID already set [" + _receiveStreamId + ", " + id + "]");
|
||||||
_receiveStreamIdSet = true;
|
_receiveStreamIdSet = true;
|
||||||
_receiveStreamId = id;
|
_receiveStreamId = id;
|
||||||
|
Reference in New Issue
Block a user