Issue #3558 - only notify WS onError if onClose has not been called

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-10-04 11:13:38 +10:00
parent fef5975b86
commit d95c825c5c
2 changed files with 6 additions and 2 deletions

View File

@ -41,6 +41,7 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class ConcurrentConnectTest
@ -130,7 +131,7 @@ public class ConcurrentConnectTest
assertTrue(l.closed.await(5, TimeUnit.SECONDS));
assertThat(l.closeCode, is(StatusCode.NORMAL));
assertThat(l.closeReason, is("close from client"));
//assertNull(l.failure); //TODO: we can get failures after close??
assertNull(l.failure);
}
closeListener.closeLatch.await(5, TimeUnit.SECONDS);

View File

@ -397,7 +397,10 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
}
if (openFuture != null && !openFuture.isDone())
openFuture.completeExceptionally(cause);
websocket.onError(cause);
// Only notify onError if onClose has not been called.
if (!onCloseCalled.get())
websocket.onError(cause);
}
/**