@@ -401,25 +401,15 @@ public void outwardClose(long error, String reason)
401
401
if (LOG .isDebugEnabled ())
402
402
LOG .debug ("outward closing 0x{}/{} on {}" , Long .toHexString (error ), reason , this );
403
403
quicheConnection .close (error , reason );
404
- try
405
- {
406
- // Flushing will eventually forward the outward close to the connection.
407
- flush ();
408
- }
409
- catch (IllegalStateException ise )
410
- {
411
- // Flusher already is in CLOSED state, nothing else to do.
412
- if (LOG .isDebugEnabled ())
413
- LOG .debug ("IllegalStateException caught while flushing, flusher={} {}" , flusher , this , ise );
414
- }
404
+ // Flushing will eventually forward the outward close to the connection.
405
+ flush ();
415
406
}
416
407
417
408
private void finishOutwardClose (Throwable failure )
418
409
{
419
410
try
420
411
{
421
412
endPoints .clear ();
422
- flusher .close ();
423
413
getQuicConnection ().outwardClose (this , failure );
424
414
}
425
415
finally
@@ -464,13 +454,6 @@ public void onTimeoutExpired()
464
454
};
465
455
}
466
456
467
- @ Override
468
- public void close ()
469
- {
470
- super .close ();
471
- timeout .destroy ();
472
- }
473
-
474
457
@ Override
475
458
protected Action process () throws IOException
476
459
{
@@ -523,17 +506,22 @@ protected void onCompleteSuccess()
523
506
{
524
507
if (LOG .isDebugEnabled ())
525
508
LOG .debug ("connection closed {}" , QuicSession .this );
526
- byteBufferPool .release (cipherBuffer );
527
- finishOutwardClose (new ClosedChannelException ());
509
+ finish (new ClosedChannelException ());
528
510
}
529
511
530
512
@ Override
531
513
protected void onCompleteFailure (Throwable failure )
532
514
{
533
515
if (LOG .isDebugEnabled ())
534
516
LOG .debug ("failed to write cipher bytes, closing session on {}" , QuicSession .this , failure );
517
+ finish (failure );
518
+ }
519
+
520
+ private void finish (Throwable failure )
521
+ {
535
522
byteBufferPool .release (cipherBuffer );
536
523
finishOutwardClose (failure );
524
+ timeout .destroy ();
537
525
}
538
526
}
539
527
0 commit comments