diff options
author | aunsane <aunsane@gmail.com> | 2017-03-27 00:50:53 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2017-03-27 00:51:31 +0300 |
commit | 80646f0b4671c647aa76cb5619f74edccb9e3108 (patch) | |
tree | 49bbda1f51bfcd669336161853dff928ef8f18b6 /protocols/Tox/src/tox_connection.cpp | |
parent | 2d161955dabcb5a8a8b6069f94945ec7657805bf (diff) |
Tox: added new options
- max connect retries
- max reconnect retries
Diffstat (limited to 'protocols/Tox/src/tox_connection.cpp')
-rw-r--r-- | protocols/Tox/src/tox_connection.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/protocols/Tox/src/tox_connection.cpp b/protocols/Tox/src/tox_connection.cpp index 89ce9a2e70..39b9474225 100644 --- a/protocols/Tox/src/tox_connection.cpp +++ b/protocols/Tox/src/tox_connection.cpp @@ -22,7 +22,8 @@ void CToxProto::TryConnect(Tox *tox) return; } - if (m_iStatus++ > TOX_MAX_CONNECT_RETRIES) + int maxConnectRetries = getByte("MaxConnectRetries", TOX_MAX_CONNECT_RETRIES); + if (m_iStatus++ > maxConnectRetries) { SetStatus(ID_STATUS_OFFLINE); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK); @@ -33,18 +34,19 @@ void CToxProto::TryConnect(Tox *tox) void CToxProto::CheckConnection(Tox *tox, int &retriesCount) { + int maxReconnectRetries = getByte("MaxReconnectRetries", TOX_MAX_RECONNECT_RETRIES); TOX_CONNECTION connectionStatus = tox_self_get_connection_status(tox); if (connectionStatus != TOX_CONNECTION_NONE) { - if (retriesCount < TOX_MAX_DISCONNECT_RETRIES) + if (retriesCount < maxReconnectRetries) { debugLogA(__FUNCTION__": restored connection with DHT"); - retriesCount = TOX_MAX_DISCONNECT_RETRIES; + retriesCount = maxReconnectRetries; } } else { - if (retriesCount == TOX_MAX_DISCONNECT_RETRIES) + if (retriesCount == maxReconnectRetries) { retriesCount--; debugLogA(__FUNCTION__": lost connection with DHT"); @@ -65,7 +67,7 @@ void CToxProto::CheckingThread(void *arg) debugLogA(__FUNCTION__": entering"); Tox *tox = (Tox*)arg; - int retriesCount = TOX_MAX_DISCONNECT_RETRIES; + int retriesCount = getByte("MaxReconnectRetries", TOX_MAX_RECONNECT_RETRIES); while (!isTerminated) { if (m_iStatus < ID_STATUS_ONLINE) |