From 0663b8bd76750f161e7ec15bad675a33b31981ca Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 25 Aug 2020 18:42:48 +0300 Subject: fixes #2522 (SkypeWeb: valid errorcode 401 processing after /endpointCreated) --- protocols/SkypeWeb/src/skype_login.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 2cf41db7c2..12b058b17c 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -118,10 +118,8 @@ void CSkypeProto::OnLoginSuccess() void CSkypeProto::OnEndpointCreated(NETLIBHTTPREQUEST *response, AsyncHttpRequest*) { - if (!IsStatusConnecting(m_iStatus)) - return; - - m_iStatus++; + if (IsStatusConnecting(m_iStatus)) + m_iStatus++; if (response == nullptr) { debugLogA(__FUNCTION__ ": failed to get create endpoint"); @@ -140,7 +138,7 @@ void CSkypeProto::OnEndpointCreated(NETLIBHTTPREQUEST *response, AsyncHttpReques if (auto *hdr = Netlib_GetHeader(response, "Location")) g_plugin.szDefaultServer = GetServerFromUrl(hdr); PushRequest(new CreateEndpointRequest(this)); - break; + return; case 401: // unauthorized if (auto *szStatus = Netlib_GetHeader(response, "StatusText")) @@ -157,12 +155,13 @@ void CSkypeProto::OnEndpointCreated(NETLIBHTTPREQUEST *response, AsyncHttpReques return; } - if (m_iStatus++ > SKYPE_MAX_CONNECT_RETRIES) { - debugLogA(__FUNCTION__ ": failed to create endpoint (too many connect retries)"); - ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); - SetStatus(ID_STATUS_OFFLINE); - return; - } + if (IsStatusConnecting(m_iStatus)) + if (m_iStatus++ > SKYPE_MAX_CONNECT_RETRIES) { + debugLogA(__FUNCTION__ ": failed to create endpoint (too many connect retries)"); + ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); + SetStatus(ID_STATUS_OFFLINE); + return; + } if (auto *hdr = Netlib_GetHeader(response, "Set-RegistrationToken")) { CMStringA szValue = hdr; -- cgit v1.2.3