Skip to content

Commit

Permalink
Issue #4855 - Occasional h2spec failures on CI
Browse files Browse the repository at this point in the history
Fixed reset() to remember the failure.

Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Jun 9, 2020
1 parent 56d3a6e commit 26ad585
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ private class TransportCallback implements Callback
private boolean _commit;
private Throwable _failure;

private void reset(boolean failed)
private void reset(Throwable failure)
{
assert Thread.holdsLock(this);
_state = failed ? State.FAILED : State.IDLE;
_state = failure != null ? State.FAILED : State.IDLE;
_callback = null;
_commit = false;
_failure = null;
_failure = failure;
}

private void send(Callback callback, boolean commit, Consumer<Callback> sendFrame)
Expand Down Expand Up @@ -453,7 +453,7 @@ private void pending()
callback = _callback;
commit = _commit;
failure = null;
reset(false);
reset(null);
break;
}
case FAILING:
Expand All @@ -463,15 +463,15 @@ private void pending()
callback = _callback;
commit = _commit;
failure = _failure;
reset(true);
reset(failure);
break;
}
default:
{
callback = _callback;
commit = _commit;
failure = new IllegalStateException("Invalid transport state: " + _state);
reset(true);
reset(failure);
break;
}
}
Expand Down Expand Up @@ -501,7 +501,7 @@ public void succeeded()
{
callback = _callback;
commit = _commit;
reset(false);
reset(null);
break;
}
default:
Expand Down Expand Up @@ -536,7 +536,7 @@ public void failed(Throwable failure)
{
callback = _callback;
commit = _commit;
reset(true);
reset(failure);
break;
}
default:
Expand All @@ -563,7 +563,7 @@ private boolean idleTimeout(Throwable failure)
// The send was started but idle timed out, fail it.
callback = _callback;
timeout = true;
reset(true);
reset(failure);
break;
}
case IDLE:
Expand All @@ -589,7 +589,7 @@ private boolean idleTimeout(Throwable failure)
callback = Callback.NOOP;
timeout = true;
failure = new IllegalStateException("Invalid transport state: " + _state, failure);
reset(true);
reset(failure);
break;
}
}
Expand Down

0 comments on commit 26ad585

Please sign in to comment.