use of com.webpieces.http2engine.api.error.ConnectionFailure in project webpieces by deanhiller.
the class Level2ParsingAndRemoteSettings method handleError.
private Void handleError(Object object, Throwable e) {
if (e == null)
return null;
else if (e instanceof ConnectionClosedException) {
log.error("Normal exception since we are closing and they do not know yet", e);
} else if (e instanceof StreamException) {
log.error("shutting the stream down due to error", e);
syncro.sendRstToServerAndApp((StreamException) e).exceptionally(t -> logExc("stream", t));
} else if (e instanceof ConnectionException) {
log.error("shutting the connection down due to error", e);
ConnectionFailure reset = new ConnectionFailure((ConnectionException) e);
//send GoAway
syncro.sendGoAwayToSvrAndResetAllToApp(reset).exceptionally(t -> logExc("connection", t));
} else {
log.error("shutting the connection down due to error(MAKE sure your clients try..catch, exceptions)", e);
ConnectionException exc = new ConnectionException(CancelReasonCode.BUG, logId, 0, e.getMessage(), e);
ConnectionFailure reset = new ConnectionFailure((ConnectionException) exc);
//send GoAwa
syncro.sendGoAwayToSvrAndResetAllToApp(reset).exceptionally(t -> logExc("connection", t));
}
return null;
}
use of com.webpieces.http2engine.api.error.ConnectionFailure in project webpieces by deanhiller.
the class Level2ParsingAndRemoteSettings method handleFinalError.
private Void handleFinalError(Object object, Throwable e) {
if (e == null)
return null;
else if (e instanceof ConnectionException) {
log.error("shutting the connection down due to error", e);
ConnectionFailure reset = new ConnectionFailure((ConnectionException) e);
// send GoAway
syncro.sendGoAwayToSvrAndResetAllToApp(reset).exceptionally(t -> logExc("connection", t));
} else if (e instanceof StreamException) {
log.error("Stream had an error", e);
streamsToDiscard.add(((StreamException) e).getStreamId());
syncro.sendRstToServerAndApp((StreamException) e).exceptionally(t -> logExc("stream", t));
} else {
log.error("shutting the connection down due to error(MAKE sure your clients try..catch, exceptions)", e);
ConnectionException exc = new ConnectionException(CancelReasonCode.BUG, logId, 0, e.getMessage(), e);
ConnectionFailure reset = new ConnectionFailure((ConnectionException) exc);
// send GoAwa
syncro.sendGoAwayToSvrAndResetAllToApp(reset).exceptionally(t -> logExc("connection", t));
}
return null;
}
use of com.webpieces.http2engine.api.error.ConnectionFailure in project webpieces by deanhiller.
the class ResponseListener method failure.
@Override
public void failure(Throwable e) {
ConnectionCancelled connCancelled = new ConnectionFailure(new ConnectionException(CancelReasonCode.BUG, logId, 0, "Failure from connection", e));
responseListener.cancel(new ShutdownStream(0, connCancelled));
}
use of com.webpieces.http2engine.api.error.ConnectionFailure in project webpieces by deanhiller.
the class Level4PreconditionChecks method createExcepted.
public XFuture<Void> createExcepted(Http2Msg payload, String extra, ConnectionCancelled closedReason) {
log.info("returning XFuture.exception since this socket is closed('" + extra + "' frame=" + payload + "):" + closedReason.getReasonCode());
XFuture<Void> future = new XFuture<>();
ConnectionClosedException exception = new ConnectionClosedException(closedReason, "Connection closed or closing:" + closedReason.getReasonCode());
if (closedReason instanceof ConnectionFailure) {
ConnectionFailure fail = (ConnectionFailure) closedReason;
exception.initCause(fail.getCause());
}
future.completeExceptionally(exception);
return future;
}
Aggregations