This repository has been archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4088 from ethereum/upnp
Disable builds with UPnP by default
- Loading branch information
Showing
6 changed files
with
21 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,24 +14,18 @@ | |
You should have received a copy of the GNU General Public License | ||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
/** @file UPnP.cpp | ||
* @authors: | ||
* Gav Wood <[email protected]> | ||
* Lefteris Karapetsas <[email protected]> | ||
* @date 2014, 2015 | ||
*/ | ||
/// @file | ||
/// UPnP port forwarding support. | ||
|
||
#include "UPnP.h" | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#if ETH_MINIUPNPC | ||
#include <miniupnpc/miniwget.h> | ||
#include <miniupnpc/miniupnpc.h> | ||
#include <miniupnpc/upnpcommands.h> | ||
#endif | ||
#include <libdevcore/Exceptions.h> | ||
#include <libdevcore/Common.h> | ||
#include <libdevcore/CommonIO.h> | ||
#include <libdevcore/Log.h> | ||
using namespace std; | ||
|
@@ -81,8 +75,8 @@ UPnP::UPnP() | |
#endif | ||
if (descXML) | ||
{ | ||
parserootdesc (descXML, descXMLsize, m_data.get()); | ||
free (descXML); descXML = 0; | ||
parserootdesc(descXML, descXMLsize, m_data.get()); | ||
free(descXML); | ||
#if MINIUPNPC_API_VERSION >= 9 | ||
GetUPNPUrls (m_urls.get(), m_data.get(), dev->descURL, 0); | ||
#else | ||
|
@@ -113,9 +107,8 @@ string UPnP::externalIP() | |
char addr[16]; | ||
if (!UPNP_GetExternalIPAddress(m_urls->controlURL, m_data->first.servicetype, addr)) | ||
return addr; | ||
else | ||
#endif | ||
return "0.0.0.0"; | ||
return "0.0.0.0"; | ||
} | ||
|
||
int UPnP::addRedirect(char const* _addr, int _port) | ||
|
@@ -137,7 +130,7 @@ int UPnP::addRedirect(char const* _addr, int _port) | |
return _port; | ||
|
||
// Failed - now try (random external, port internal) and cycle up to 10 times. | ||
srand(time(NULL)); | ||
srand(static_cast<unsigned int>(time(nullptr))); | ||
for (unsigned i = 0; i < 10; ++i) | ||
{ | ||
_port = rand() % (32768 - 1024) + 1024; | ||
|
@@ -181,7 +174,6 @@ void UPnP::removeRedirect(int _port) | |
(void)_port; | ||
#if ETH_MINIUPNPC | ||
char port_str[16]; | ||
// int t; | ||
printf("TB : upnp_rem_redir (%d)\n", _port); | ||
if (m_urls->controlURL[0] == '\0') | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters