File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 1818static inline ConnectionHandler* instantiate_handler (NetworkAdapter adapter);
1919
2020bool GenericConnectionHandler::updateSetting (const models::NetworkSetting& s) {
21- if (_ch != nullptr && _ch->_current_net_connection_state != NetworkConnectionState::INIT) {
22- // If the internal connection handler is already being used and not in INIT phase we cannot update the settings
23- return false ;
24- } else if (_ch != nullptr && _ch->_current_net_connection_state == NetworkConnectionState::INIT && _interface != s.type ) {
25- // If the internal connection handler is already being used and in INIT phase and the interface type is being changed
26- // -> we need to deallocate the previously allocated handler
27-
21+ if (_ch != nullptr ) {
22+ if (_ch->_current_net_connection_state == NetworkConnectionState::CONNECTING ||
23+ _ch->_current_net_connection_state == NetworkConnectionState::CONNECTED ||
24+ _ch->_current_net_connection_state == NetworkConnectionState::DISCONNECTING) {
25+ // If the internal connection handler is already being used and active we cannot update the settings
26+ return false ;
27+ } else if (_interface != s.type ) {
28+ // If the internal connection handler is not active and the interface type is being changed
29+ // -> we need to deallocate the previously allocated handler
30+ delete _ch;
31+ _ch = nullptr ;
32+ }
2833 // if interface type is not being changed -> we just need to call updateSettings
29- delete _ch;
30- _ch = nullptr ;
3134 }
3235
33- if (_ch == nullptr ) {
36+ if (_ch == nullptr ) {
3437 _ch = instantiate_handler (s.type );
3538 }
3639
37- if (_ch != nullptr ) {
40+ if (_ch != nullptr ) {
3841 _interface = s.type ;
3942 _ch->setKeepAlive (_keep_alive);
4043 _ch->enableCheckInternetAvailability (_check_internet_availability);
4144 return _ch->updateSetting (s);
4245 } else {
4346 _interface = NetworkAdapter::NONE;
44-
4547 return false ;
4648 }
4749}
You can’t perform that action at this time.
0 commit comments