Issue #10346 - also fix the ee9/ee8 NetworkFuzzer
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
247a341bee
commit
df2480aef7
|
@ -29,6 +29,7 @@ import org.eclipse.jetty.io.EndPoint;
|
|||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.FutureCallback;
|
||||
import org.eclipse.jetty.util.thread.AutoLock;
|
||||
import org.eclipse.jetty.websocket.core.Behavior;
|
||||
import org.eclipse.jetty.websocket.core.CloseStatus;
|
||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||
|
@ -214,9 +215,11 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab
|
|||
public static class FrameCapture implements FrameHandler
|
||||
{
|
||||
private final BlockingQueue<Frame> receivedFrames = new LinkedBlockingQueue<>();
|
||||
private final CountDownLatch openLatch = new CountDownLatch(1);
|
||||
private EndPoint endPoint;
|
||||
private CountDownLatch openLatch = new CountDownLatch(1);
|
||||
private CoreSession coreSession;
|
||||
private final AutoLock lock = new AutoLock();
|
||||
|
||||
|
||||
public void setEndPoint(EndPoint endpoint)
|
||||
{
|
||||
|
@ -235,8 +238,11 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab
|
|||
@Override
|
||||
public void onFrame(Frame frame, Callback callback)
|
||||
{
|
||||
receivedFrames.offer(Frame.copy(frame));
|
||||
callback.succeeded();
|
||||
try (AutoLock ignored = lock.lock())
|
||||
{
|
||||
receivedFrames.add(Frame.copy(frame));
|
||||
callback.succeeded();
|
||||
}
|
||||
coreSession.demand();
|
||||
}
|
||||
|
||||
|
@ -263,7 +269,7 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab
|
|||
throw new IOException(e);
|
||||
}
|
||||
|
||||
synchronized (this)
|
||||
try (AutoLock ignored = lock.lock())
|
||||
{
|
||||
FutureCallback callback = new FutureCallback();
|
||||
endPoint.write(callback, buffer);
|
||||
|
|
Loading…
Reference in New Issue