Align formatting with clang-format

This commit is contained in:
Hennadii Stepanov 2019-05-06 23:17:51 +03:00
parent 91a1b85083
commit 02709e9560
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -1423,36 +1423,32 @@ static void ThreadMapPort()
if (fDiscover) { if (fDiscover) {
char externalIPAddress[40]; char externalIPAddress[40];
r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress); r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress);
if(r != UPNPCOMMAND_SUCCESS) if (r != UPNPCOMMAND_SUCCESS) {
LogPrintf("UPnP: GetExternalIPAddress() returned %d\n", r); LogPrintf("UPnP: GetExternalIPAddress() returned %d\n", r);
else } else {
{ if (externalIPAddress[0]) {
if(externalIPAddress[0])
{
CNetAddr resolved; CNetAddr resolved;
if (LookupHost(externalIPAddress, resolved, false)) { if (LookupHost(externalIPAddress, resolved, false)) {
LogPrintf("UPnP: ExternalIPAddress = %s\n", resolved.ToString().c_str()); LogPrintf("UPnP: ExternalIPAddress = %s\n", resolved.ToString().c_str());
AddLocal(resolved, LOCAL_UPNP); AddLocal(resolved, LOCAL_UPNP);
} }
} } else {
else
LogPrintf("UPnP: GetExternalIPAddress failed.\n"); LogPrintf("UPnP: GetExternalIPAddress failed.\n");
} }
} }
}
std::string strDesc = PACKAGE_NAME " " + FormatFullVersion(); std::string strDesc = PACKAGE_NAME " " + FormatFullVersion();
do { do {
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
if(r!=UPNPCOMMAND_SUCCESS) if (r != UPNPCOMMAND_SUCCESS) {
LogPrintf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", LogPrintf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", port, port, lanaddr, r, strupnperror(r));
port, port, lanaddr, r, strupnperror(r)); } else {
else
LogPrintf("UPnP Port Mapping successful.\n"); LogPrintf("UPnP Port Mapping successful.\n");
} }
while(g_upnp_interrupt.sleep_for(std::chrono::minutes(20))); } while (g_upnp_interrupt.sleep_for(std::chrono::minutes(20)));
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0); r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
LogPrintf("UPNP_DeletePortMapping() returned: %d\n", r); LogPrintf("UPNP_DeletePortMapping() returned: %d\n", r);