Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/ConnectionHandlerInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ NetworkConnectionState ConnectionHandler::updateConnectionState() {
case NetworkConnectionState::CONNECTED: next_net_connection_state = update_handleConnected (); break;
case NetworkConnectionState::DISCONNECTING: next_net_connection_state = update_handleDisconnecting(); break;
case NetworkConnectionState::DISCONNECTED: next_net_connection_state = update_handleDisconnected (); break;
case NetworkConnectionState::ERROR: break;
case NetworkConnectionState::ERROR: next_net_connection_state = update_handleError (); break;
case NetworkConnectionState::CLOSED: break;
}

Expand All @@ -88,6 +88,15 @@ NetworkConnectionState ConnectionHandler::updateConnectionState() {
return next_net_connection_state;
}

NetworkConnectionState ConnectionHandler::update_handleError()
{
if (_keep_alive) {
return NetworkConnectionState::INIT;
}

return NetworkConnectionState::ERROR;
}

void ConnectionHandler::updateCallback(NetworkConnectionState next_net_connection_state) {

/* Check the next state to determine the kind of state conversion which has occurred (and call the appropriate callback) */
Expand Down
1 change: 1 addition & 0 deletions src/ConnectionHandlerInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class ConnectionHandler {
virtual NetworkConnectionState update_handleConnected () = 0;
virtual NetworkConnectionState update_handleDisconnecting() = 0;
virtual NetworkConnectionState update_handleDisconnected () = 0;
virtual NetworkConnectionState update_handleError ();

models::NetworkSetting _settings;

Expand Down
4 changes: 4 additions & 0 deletions src/GenericConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,7 @@ NetworkConnectionState GenericConnectionHandler::update_handleDisconnecting() {
NetworkConnectionState GenericConnectionHandler::update_handleDisconnected() {
return _ch != nullptr ? _ch->update_handleDisconnected() : NetworkConnectionState::INIT;
}

NetworkConnectionState GenericConnectionHandler::update_handleError() {
return _ch != nullptr ? _ch->update_handleError() : NetworkConnectionState::INIT;
}
1 change: 1 addition & 0 deletions src/GenericConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class GenericConnectionHandler : public ConnectionHandler
NetworkConnectionState update_handleConnected () override;
NetworkConnectionState update_handleDisconnecting() override;
NetworkConnectionState update_handleDisconnected () override;
NetworkConnectionState update_handleError () override;

private:

Expand Down
Loading