File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
core/src/main/java/io/undertow/server/protocol/http Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -139,12 +139,21 @@ public void handleEvent(final ConduitStreamSourceChannel channel) {
139
139
public void handleEventWithNoRunningRequest (final ConduitStreamSourceChannel channel ) {
140
140
PooledByteBuffer existing = connection .getExtraBytes ();
141
141
if ((existing == null && connection .getOriginalSourceConduit ().isReadShutdown ()) || connection .getOriginalSinkConduit ().isWriteShutdown ()) {
142
+ UndertowLogger .REQUEST_IO_LOGGER .debug ("Connection is closing, cancelling handling of request" );
143
+ IoUtils .safeClose (connection );
144
+ channel .suspendReads ();
145
+ return ;
146
+ }
147
+ final PooledByteBuffer pooled ;
148
+ try {
149
+ pooled = existing == null ? connection .getByteBufferPool ().allocate () : existing ;
150
+ } catch (IllegalStateException e ) {
151
+ UndertowLogger .REQUEST_IO_LOGGER .debug ("Connection is closing, cancelling handling of request" , e );
152
+ // shutdown started after previous if statement, so treat it like previous statement
142
153
IoUtils .safeClose (connection );
143
154
channel .suspendReads ();
144
155
return ;
145
156
}
146
-
147
- final PooledByteBuffer pooled = existing == null ? connection .getByteBufferPool ().allocate () : existing ;
148
157
final ByteBuffer buffer = pooled .getBuffer ();
149
158
boolean free = true ;
150
159
You can’t perform that action at this time.
0 commit comments