slightly prettified the code

This commit is contained in:
Emiel Bruijntjes 2019-01-10 08:25:31 +01:00
parent 964398292a
commit e10fd61ac8
1 changed files with 7 additions and 11 deletions

View File

@ -110,9 +110,9 @@ private:
*/ */
TcpState *repeat(const Monitor &monitor, enum State state, int error) TcpState *repeat(const Monitor &monitor, enum State state, int error)
{ {
// if we are able to repeat the call, we are still in the correct state // if we are not able to repeat the call, we are in an error state and should tear down the connection
if (repeat(state, error)) if (!repeat(state, error)) return monitor.valid() ? new TcpClosed(this) : nullptr;
{
// if the socket was closed in the meantime and we are not sending anything any more, we should initialize the shutdown sequence // if the socket was closed in the meantime and we are not sending anything any more, we should initialize the shutdown sequence
if (_closed && _state == state_idle) return new SslShutdown(this, std::move(_ssl)); if (_closed && _state == state_idle) return new SslShutdown(this, std::move(_ssl));
@ -120,10 +120,6 @@ private:
else return this; else return this;
} }
// if the monitor is still valid, we should tear down the connection because we are unable to repeat the call
return monitor.valid() ? new TcpClosed(this) : nullptr;
}
/** /**
* Method to repeat the previous call, which has then been * Method to repeat the previous call, which has then been
* @param state the state that we were in * @param state the state that we were in