Issue #2788 - Graceful close of HTTP/2 Connection.
Updates after review. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
92d9d46f8e
commit
8b1a669e65
|
@ -720,6 +720,8 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
|
|||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Ignoring shutdown, already closed");
|
||||
Callback.Completable result = closeCallback;
|
||||
// Result may be null if the shutdown is in progress,
|
||||
// don't wait and return a completed CompletableFuture.
|
||||
return result != null ? result : CompletableFuture.completedFuture(null);
|
||||
}
|
||||
}
|
||||
|
@ -1077,7 +1079,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
|
|||
{
|
||||
Callback.Completable callback = closeCallback;
|
||||
// Only send the close frame if we can flip Hi, see shutdown().
|
||||
if (callback != null && streamCount.compareAndSetHi(0, 1))
|
||||
if (callback != null && streamCount.compareAndSet(0, 1, 0, 0))
|
||||
control(null, callback, closeFrame);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,6 +156,8 @@ public interface ISession extends Session
|
|||
/**
|
||||
* <p>Gracefully closes the session, returning a {@code CompletableFuture} that
|
||||
* is completed when all the streams currently being processed are completed.</p>
|
||||
* <p>Implementation is idempotent, i.e. calling this method a second time
|
||||
* or concurrently results in a no-operation.</p>
|
||||
*
|
||||
* @return a {@code CompletableFuture} that is completed when all the streams are completed
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue