mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-12 22:15:02 +00:00
perf[net]: negative signalId and sid are allowed
This commit is contained in:
1 parent
7281034136
commit
3128a27571
2 files changed
+6
-10
No files matched your search
@@ -26,6 +26,10 @@ public class SignalAttachment implements IAttachment {
|
||||
|
||||
public static final short PROTOCOL_ID = 0;
|
||||
|
||||
/**
|
||||
* EN:Negative signalId are allowed
|
||||
* CN:允许负数的signalId
|
||||
*/
|
||||
public static final AtomicInteger ATOMIC_ID = new AtomicInteger(0);
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,9 +28,9 @@ public class Session implements Closeable {
|
||||
private static final AtomicLong ATOMIC_LONG = new AtomicLong(0);
|
||||
|
||||
/**
|
||||
* The globally unique ID of the session
|
||||
* The globally unique ID of the session and the negative sid are allowed
|
||||
*/
|
||||
private long sid;
|
||||
private long sid = ATOMIC_LONG.incrementAndGet();
|
||||
|
||||
private Channel channel;
|
||||
|
||||
@@ -52,10 +52,6 @@ public class Session implements Closeable {
|
||||
if (channel == null) {
|
||||
throw new IllegalArgumentException("channel cannot be empty");
|
||||
}
|
||||
this.sid = ATOMIC_LONG.incrementAndGet();
|
||||
if (this.sid <= 0) {
|
||||
throw new IllegalArgumentException("sid cannot be 0");
|
||||
}
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
@@ -91,10 +87,6 @@ public class Session implements Closeable {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(long sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
|
||||
public Channel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user