Simplified abort logic.
This commit is contained in:
parent
31a0b36f3c
commit
bbc2d0c29d
|
@ -492,9 +492,7 @@ public abstract class HttpSender implements AsyncContentProvider.Listener
|
|||
|
||||
public boolean abort(Throwable failure)
|
||||
{
|
||||
RequestState current = requestState.get();
|
||||
boolean abortable = isBeforeCommit(current) || isSending(current);
|
||||
return abortable && anyToFailure(failure);
|
||||
return anyToFailure(failure);
|
||||
}
|
||||
|
||||
private boolean updateRequestState(RequestState from, RequestState to)
|
||||
|
@ -513,33 +511,6 @@ public abstract class HttpSender implements AsyncContentProvider.Listener
|
|||
return updated;
|
||||
}
|
||||
|
||||
private boolean isBeforeCommit(RequestState requestState)
|
||||
{
|
||||
switch (requestState)
|
||||
{
|
||||
case TRANSIENT:
|
||||
case QUEUED:
|
||||
case BEGIN:
|
||||
case HEADERS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSending(RequestState requestState)
|
||||
{
|
||||
switch (requestState)
|
||||
{
|
||||
case TRANSIENT_CONTENT:
|
||||
case COMMIT:
|
||||
case CONTENT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private RuntimeException illegalSenderState(SenderState current)
|
||||
{
|
||||
return new IllegalStateException("Expected " + current + " found " + senderState.get() + " instead");
|
||||
|
|
Loading…
Reference in New Issue