예제 #1
0
 private void goAway(SessionStatus sessionStatus, long timeout, TimeUnit unit, Callback callback) {
   if (goAwaySent.compareAndSet(false, true)) {
     if (!goAwayReceived.get()) {
       GoAwayFrame frame = new GoAwayFrame(version, lastStreamId.get(), sessionStatus.getCode());
       control(null, frame, timeout, unit, callback);
       return;
     }
   }
   complete(callback);
 }
예제 #2
0
 @Override
 public void rst(RstInfo rstInfo, Callback callback) {
   // SPEC v3, 2.2.2
   if (goAwaySent.get()) {
     complete(callback);
   } else {
     int streamId = rstInfo.getStreamId();
     IStream stream = streams.get(streamId);
     RstStreamFrame frame =
         new RstStreamFrame(version, streamId, rstInfo.getStreamStatus().getCode(version));
     control(stream, frame, rstInfo.getTimeout(), rstInfo.getUnit(), callback);
     if (stream != null) {
       stream.process(frame);
       removeStream(stream);
     }
   }
 }