Fixed a bug where DiscardClient didn't work since the last optimization
This commit is contained in:
parent
39086edae6
commit
362ecf640b
@ -318,14 +318,17 @@ class NioWorker implements Runnable {
|
|||||||
static void write(final NioSocketChannel channel, boolean mightNeedWakeup) {
|
static void write(final NioSocketChannel channel, boolean mightNeedWakeup) {
|
||||||
if (mightNeedWakeup) {
|
if (mightNeedWakeup) {
|
||||||
NioWorker worker = channel.getWorker();
|
NioWorker worker = channel.getWorker();
|
||||||
if (worker != null && Thread.currentThread() != worker.thread) {
|
if (worker != null) {
|
||||||
if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) {
|
Thread workerThread = worker.thread;
|
||||||
worker.taskQueue.offer(channel.writeTask);
|
if (workerThread != null && Thread.currentThread() != workerThread) {
|
||||||
|
if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) {
|
||||||
|
worker.taskQueue.offer(channel.writeTask);
|
||||||
|
}
|
||||||
|
if (worker.wakenUp.compareAndSet(false, true)) {
|
||||||
|
worker.selector.wakeup();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (worker.wakenUp.compareAndSet(false, true)) {
|
|
||||||
worker.selector.wakeup();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +370,6 @@ class NioWorker implements Runnable {
|
|||||||
if (internalWriteBuffer.isEmpty()) {
|
if (internalWriteBuffer.isEmpty()) {
|
||||||
channel.writeBuffer.drainTo(internalWriteBuffer);
|
channel.writeBuffer.drainTo(internalWriteBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
evt = channel.currentWriteEvent;
|
evt = channel.currentWriteEvent;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (evt == null) {
|
if (evt == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user