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 18
18
static inline ConnectionHandler* instantiate_handler (NetworkAdapter adapter);
19
19
20
20
bool 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
+ }
28
33
// if interface type is not being changed -> we just need to call updateSettings
29
- delete _ch;
30
- _ch = nullptr ;
31
34
}
32
35
33
- if (_ch == nullptr ) {
36
+ if (_ch == nullptr ) {
34
37
_ch = instantiate_handler (s.type );
35
38
}
36
39
37
- if (_ch != nullptr ) {
40
+ if (_ch != nullptr ) {
38
41
_interface = s.type ;
39
42
_ch->setKeepAlive (_keep_alive);
40
43
_ch->enableCheckInternetAvailability (_check_internet_availability);
41
44
return _ch->updateSetting (s);
42
45
} else {
43
46
_interface = NetworkAdapter::NONE;
44
-
45
47
return false ;
46
48
}
47
49
}
You can’t perform that action at this time.
0 commit comments