Browse Source

miniupnp dependency removed, yes! :-) fix #130

libtorrent implements a upnp client: use it to map the other twisterd port.
miguelfreitas
Miguel Freitas 11 years ago
parent
commit
2168e34677
  1. 6
      Makefile.am
  2. 27
      configure.ac
  3. 26
      doc/build-unix.md
  4. 1
      libtorrent/include/libtorrent/aux_/session_impl.hpp
  5. 11
      libtorrent/src/session_impl.cpp
  6. 6
      src/init.cpp
  7. 5
      src/main.h
  8. 13
      src/makefile.android
  9. 12
      src/makefile.freebsd
  10. 8
      src/makefile.mingw
  11. 12
      src/makefile.osx
  12. 13
      src/makefile.unix
  13. 8
      src/twister.cpp
  14. 17
      twister-qt.pro

6
Makefile.am

@ -162,17 +162,13 @@ BITCOIN_TWISTER_SOURCES = \
src/twister_utils.cpp \ src/twister_utils.cpp \
$(SSE2_SOURCES) $(SSE2_SOURCES)
if USE_UPNP
UPNP_LIB = -lminiupnpc
endif
twisterd_SOURCES = $(LIBTORRENT_SOURCES) $(BITCOIN_TWISTER_SOURCES) twisterd_SOURCES = $(LIBTORRENT_SOURCES) $(BITCOIN_TWISTER_SOURCES)
twisterd_LDFLAGS = @OPENSSL_LDFLAGS@ @DB_CXX_LDFLAGS@ twisterd_LDFLAGS = @OPENSSL_LDFLAGS@ @DB_CXX_LDFLAGS@
twisterd_DEPENDENCIES = $(LEVELDB_LIB) twisterd_DEPENDENCIES = $(LEVELDB_LIB)
twisterd_LDADD = $(LEVELDB_LIB) $(UPNP_LIB) \ twisterd_LDADD = $(LEVELDB_LIB) \
@BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_THREAD_LIB@ @BOOST_CHRONO_LIB@ @BOOST_LOCALE_LIB@ \ @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_THREAD_LIB@ @BOOST_CHRONO_LIB@ @BOOST_LOCALE_LIB@ \
@BOOST_REGEX_LIB@ @DB_CXX_LIBS@ @OPENSSL_LIBS@ @BOOST_REGEX_LIB@ @DB_CXX_LIBS@ @OPENSSL_LIBS@

27
configure.ac

@ -205,16 +205,6 @@ AC_ARG_ENABLE(
[[ARG_ENABLE_SSE2=yes]] [[ARG_ENABLE_SSE2=yes]]
) )
AC_ARG_ENABLE(
[upnp],
[AS_HELP_STRING(
[--enable-upnp],
[enable miniupnp support [default=yes]])],
[[ARG_ENABLE_UPNP=$enableval]],
[[ARG_ENABLE_UPNP=yes]]
)
AC_ARG_ENABLE( AC_ARG_ENABLE(
[pool-allocators], [pool-allocators],
[AS_HELP_STRING( [AS_HELP_STRING(
@ -474,21 +464,6 @@ AS_CASE(["$ARG_ENABLE_SSE2"],
AC_MSG_ERROR([Unknown option "$ARG_ENABLE_SSE2". Use either "yes" or "no".])] AC_MSG_ERROR([Unknown option "$ARG_ENABLE_SSE2". Use either "yes" or "no".])]
) )
AC_MSG_CHECKING([whether miniupnp should be enabled])
AS_CASE(["$ARG_ENABLE_UPNP"],
["yes"|"on"], [
AC_MSG_RESULT([yes])
AC_DEFINE([USE_UPNP],[1],[Enable miniupnp])
COMPILETIME_OPTIONS="$COMPILETIME_OPTIONS -DUSE_UPNP=1 "
],
["no"|"off"], [
AC_MSG_RESULT([no])
],
[AC_MSG_RESULT([$ARG_ENABLE_UPNP])
AC_MSG_ERROR([Unknown option "$ARG_ENABLE_UPNP". Use either "yes" or "no".])]
)
AC_MSG_CHECKING([whether geoip support should be enabled]) AC_MSG_CHECKING([whether geoip support should be enabled])
AS_CASE(["$ARG_ENABLE_GEOIP"], AS_CASE(["$ARG_ENABLE_GEOIP"],
["yes"], [ ["yes"], [
@ -652,7 +627,6 @@ AM_CONDITIONAL([ENABLE_PYTHON_BINDING], [test "x$ARG_ENABLE_PYTHON_BINDING" = "x
AM_CONDITIONAL([WITH_SHIPPED_GEOIP], [test "x$ARG_WITH_LIBGEOIP" = "xno" ]) AM_CONDITIONAL([WITH_SHIPPED_GEOIP], [test "x$ARG_WITH_LIBGEOIP" = "xno" ])
AM_CONDITIONAL([WITH_OPENSSL], [test "x$ARG_ENABLE_ENCRYPTION" = "xyes" -o "x$ARG_ENABLE_ENCRYPTION" = "xon" ]) AM_CONDITIONAL([WITH_OPENSSL], [test "x$ARG_ENABLE_ENCRYPTION" = "xyes" -o "x$ARG_ENABLE_ENCRYPTION" = "xon" ])
AM_CONDITIONAL([USE_SSE2], [test "x$ARG_ENABLE_SSE2" = "xyes" -o "x$ARG_ENABLE_SSE2" = "xon" ]) AM_CONDITIONAL([USE_SSE2], [test "x$ARG_ENABLE_SSE2" = "xyes" -o "x$ARG_ENABLE_SSE2" = "xon" ])
AM_CONDITIONAL([USE_UPNP], [test "x$ARG_ENABLE_UPNP" = "xyes" -o "x$ARG_ENABLE_UPNP" = "xon" ])
############################################################################### ###############################################################################
# Other useful stuff # Other useful stuff
@ -751,7 +725,6 @@ Build options:
Features: Features:
encryption support: ${ARG_ENABLE_ENCRYPTION:-yes} encryption support: ${ARG_ENABLE_ENCRYPTION:-yes}
SSE2 Scrypt: ${ARG_ENABLE_SSE2:-yes} SSE2 Scrypt: ${ARG_ENABLE_SSE2:-yes}
miniupnp support: ${ARG_ENABLE_UPNP:-yes}
geoip support: ${ARG_ENABLE_GEOIP:-yes} geoip support: ${ARG_ENABLE_GEOIP:-yes}
dht support: ${ARG_ENABLE_DHT:-yes} dht support: ${ARG_ENABLE_DHT:-yes}
pool allocators: ${ARG_ENABLE_POOL_ALLOC:-yes} pool allocators: ${ARG_ENABLE_POOL_ALLOC:-yes}

26
doc/build-unix.md

@ -18,15 +18,6 @@ Dependencies
libssl SSL Support Secure communications libssl SSL Support Secure communications
libdb4.8 Berkeley DB Blockchain & wallet storage libdb4.8 Berkeley DB Blockchain & wallet storage
libboost Boost C++ Library libboost Boost C++ Library
miniupnpc UPnP Support Optional firewall-jumping support
[miniupnpc](http://miniupnp.free.fr/) may be used for UPnP port mapping. It can be downloaded from [here](
http://miniupnp.tuxfamily.org/files/). UPnP support is compiled in and
turned off by default. Set USE_UPNP to a different value to control this:
USE_UPNP= No UPnP support miniupnp not required
USE_UPNP=0 (the default) UPnP support turned off by default at runtime
USE_UPNP=1 UPnP support turned on by default at runtime
IPv6 support may be disabled by setting: IPv6 support may be disabled by setting:
@ -36,14 +27,12 @@ Licenses of statically linked libraries:
Berkeley DB New BSD license with additional requirement that linked Berkeley DB New BSD license with additional requirement that linked
software must be free open source software must be free open source
Boost MIT-like license Boost MIT-like license
miniupnpc New (3-clause) BSD license
- Versions used in this release: - Versions used in this release:
- GCC 4.3.3 - GCC 4.3.3
- OpenSSL 1.0.1c - OpenSSL 1.0.1c
- Berkeley DB 4.8.30.NC - Berkeley DB 4.8.30.NC
- Boost 1.37 - Boost 1.37
- miniupnpc 1.6
Dependency Build Instructions: Ubuntu & Debian Dependency Build Instructions: Ubuntu & Debian
---------------------------------------------- ----------------------------------------------
@ -69,10 +58,6 @@ for other Ubuntu & Debian:
(If using Boost 1.37, append -mt to the boost libraries in the makefile) (If using Boost 1.37, append -mt to the boost libraries in the makefile)
Optional:
sudo apt-get install libminiupnpc-dev (see USE_UPNP compile flag)
Dependency Build Instructions: Gentoo Dependency Build Instructions: Gentoo
------------------------------------- -------------------------------------
@ -85,7 +70,7 @@ Note: If you just want to install bitcoind on Gentoo, you can add the Bitcoin ov
Take the following steps to build (no UPnP support): Take the following steps to build (no UPnP support):
cd ${BITCOIN_DIR}/src cd ${BITCOIN_DIR}/src
make -f makefile.unix USE_UPNP= USE_IPV6=1 BDB_INCLUDE_PATH='/usr/include/db4.8' make -f makefile.unix USE_IPV6=1 BDB_INCLUDE_PATH='/usr/include/db4.8'
strip bitcoind strip bitcoind
@ -95,15 +80,6 @@ The release is built with GCC and then "strip bitcoind" to strip the debug
symbols, which reduces the executable size by about 90%. symbols, which reduces the executable size by about 90%.
miniupnpc
---------
tar -xzvf miniupnpc-1.6.tar.gz
cd miniupnpc-1.6
make
sudo su
make install
Berkeley DB Berkeley DB
----------- -----------
You need Berkeley DB 4.8. If you have to build Berkeley DB yourself: You need Berkeley DB 4.8. If you have to build Berkeley DB yourself:

1
libtorrent/include/libtorrent/aux_/session_impl.hpp

@ -957,6 +957,7 @@ namespace libtorrent
// 0 is natpmp 1 is upnp // 0 is natpmp 1 is upnp
int m_tcp_mapping[2]; int m_tcp_mapping[2];
int m_twister_tcp_mapping[2];
int m_udp_mapping[2]; int m_udp_mapping[2];
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
int m_ssl_mapping[2]; int m_ssl_mapping[2];

11
libtorrent/src/session_impl.cpp

@ -85,6 +85,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/random.hpp" #include "libtorrent/random.hpp"
#include "libtorrent/magnet_uri.hpp" #include "libtorrent/magnet_uri.hpp"
#include "twister.h" // for LIBTORRENT_PORT_OFFSET
#if defined TORRENT_STATS && defined __MACH__ #if defined TORRENT_STATS && defined __MACH__
#include <mach/task.h> #include <mach/task.h>
#endif #endif
@ -766,6 +768,8 @@ namespace aux {
m_tcp_mapping[0] = -1; m_tcp_mapping[0] = -1;
m_tcp_mapping[1] = -1; m_tcp_mapping[1] = -1;
m_twister_tcp_mapping[0] = -1;
m_twister_tcp_mapping[1] = -1;
m_udp_mapping[0] = -1; m_udp_mapping[0] = -1;
m_udp_mapping[1] = -1; m_udp_mapping[1] = -1;
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
@ -2463,6 +2467,9 @@ retry:
{ {
if (m_tcp_mapping[0] != -1) m_natpmp->delete_mapping(m_tcp_mapping[0]); if (m_tcp_mapping[0] != -1) m_natpmp->delete_mapping(m_tcp_mapping[0]);
m_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, tcp_port, tcp_port); m_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, tcp_port, tcp_port);
if (m_twister_tcp_mapping[0] != -1) m_natpmp->delete_mapping(m_twister_tcp_mapping[0]);
m_twister_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp,
tcp_port-LIBTORRENT_PORT_OFFSET, tcp_port-LIBTORRENT_PORT_OFFSET);
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
if (m_ssl_mapping[0] != -1) m_natpmp->delete_mapping(m_ssl_mapping[0]); if (m_ssl_mapping[0] != -1) m_natpmp->delete_mapping(m_ssl_mapping[0]);
m_ssl_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, ssl_port, ssl_port); m_ssl_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, ssl_port, ssl_port);
@ -2472,6 +2479,9 @@ retry:
{ {
if (m_tcp_mapping[1] != -1) m_upnp->delete_mapping(m_tcp_mapping[1]); if (m_tcp_mapping[1] != -1) m_upnp->delete_mapping(m_tcp_mapping[1]);
m_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp, tcp_port, tcp_port); m_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp, tcp_port, tcp_port);
if (m_twister_tcp_mapping[1] != -1) m_upnp->delete_mapping(m_twister_tcp_mapping[1]);
m_twister_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp,
tcp_port-LIBTORRENT_PORT_OFFSET, tcp_port-LIBTORRENT_PORT_OFFSET);
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
if (m_ssl_mapping[1] != -1) m_upnp->delete_mapping(m_ssl_mapping[1]); if (m_ssl_mapping[1] != -1) m_upnp->delete_mapping(m_ssl_mapping[1]);
m_ssl_mapping[1] = m_upnp->add_mapping(upnp::tcp, ssl_port, ssl_port); m_ssl_mapping[1] = m_upnp->add_mapping(upnp::tcp, ssl_port, ssl_port);
@ -6249,6 +6259,7 @@ retry:
m_upnp->close(); m_upnp->close();
m_udp_mapping[1] = -1; m_udp_mapping[1] = -1;
m_tcp_mapping[1] = -1; m_tcp_mapping[1] = -1;
m_twister_tcp_mapping[1] = -1;
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
m_ssl_mapping[1] = -1; m_ssl_mapping[1] = -1;
#endif #endif

6
src/init.cpp

@ -211,13 +211,7 @@ std::string HelpMessage()
strUsage += " -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n"; strUsage += " -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n";
strUsage += " -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n"; strUsage += " -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n";
strUsage += " -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n"; strUsage += " -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n";
#ifdef USE_UPNP
#if USE_UPNP
strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n"; strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n";
#else
strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n";
#endif
#endif
strUsage += " -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n"; strUsage += " -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n";
if (fHaveGUI) if (fHaveGUI)
strUsage += " -server " + _("Accept command line and JSON-RPC commands") + "\n"; strUsage += " -server " + _("Accept command line and JSON-RPC commands") + "\n";

5
src/main.h

@ -54,11 +54,6 @@ static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20
static const int MAX_SCRIPTCHECK_THREADS = 16; static const int MAX_SCRIPTCHECK_THREADS = 16;
/** Default amount of block size reserved for high-priority transactions (in bytes) */ /** Default amount of block size reserved for high-priority transactions (in bytes) */
static const int DEFAULT_BLOCK_PRIORITY_SIZE = 27000; static const int DEFAULT_BLOCK_PRIORITY_SIZE = 27000;
#ifdef USE_UPNP
static const int fHaveUPnP = true;
#else
static const int fHaveUPnP = false;
#endif
/** The maximum size for spam messages */ /** The maximum size for spam messages */
static const int MAX_SPAM_MSG_SIZE = 140; static const int MAX_SPAM_MSG_SIZE = 140;
/** The maximum size for username */ /** The maximum size for username */

13
src/makefile.android

@ -2,11 +2,6 @@
# Distributed under the MIT/X11 software license, see the accompanying # Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# :=0 --> UPnP support turned off by default at runtime
# :=1 --> UPnP support turned on by default at runtime
# :=- --> No UPnP support - miniupnp not required
USE_UPNP:=-
# :=1 --> Enable IPv6 support # :=1 --> Enable IPv6 support
# :=0 --> Disable IPv6 support # :=0 --> Disable IPv6 support
USE_IPV6:=0 USE_IPV6:=0
@ -36,14 +31,6 @@ TESTLIBS += \
-Wl,-B$(LMODE) \ -Wl,-B$(LMODE) \
-l boost_unit_test_framework$(BOOST_LIB_SUFFIX) -l boost_unit_test_framework$(BOOST_LIB_SUFFIX)
ifndef USE_UPNP
override USE_UPNP = -
endif
ifneq (${USE_UPNP}, -)
LIBS += -l miniupnpc
DEFS += -DUSE_UPNP=$(USE_UPNP)
endif
ifneq (${USE_IPV6}, -) ifneq (${USE_IPV6}, -)
DEFS += -DUSE_IPV6=$(USE_IPV6) DEFS += -DUSE_IPV6=$(USE_IPV6)
endif endif

12
src/makefile.freebsd

@ -2,11 +2,6 @@
# Distributed under the MIT/X11 software license, see the accompanying # Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# :=0 --> UPnP support turned off by default at runtime
# :=1 --> UPnP support turned on by default at runtime
# :=- --> No UPnP support - miniupnp not required
USE_UPNP:=1
# :=1 --> Enable IPv6 support # :=1 --> Enable IPv6 support
# :=0 --> Disable IPv6 support # :=0 --> Disable IPv6 support
USE_IPV6:=1 USE_IPV6:=1
@ -48,13 +43,6 @@ TESTLIBS += \
-Wl,-B$(LMODE) \ -Wl,-B$(LMODE) \
-l boost_unit_test_framework$(BOOST_LIB_SUFFIX) -l boost_unit_test_framework$(BOOST_LIB_SUFFIX)
ifndef USE_UPNP
override USE_UPNP = -
endif
ifneq (${USE_UPNP}, -)
LIBS += -l miniupnpc
DEFS += -DUSE_UPNP=$(USE_UPNP)
endif
ifneq (${USE_IPV6}, -) ifneq (${USE_IPV6}, -)
DEFS += -DUSE_IPV6=$(USE_IPV6) DEFS += -DUSE_IPV6=$(USE_IPV6)

8
src/makefile.mingw

@ -17,7 +17,6 @@
CXX ?= g++ CXX ?= g++
USE_UPNP:=-
USE_IPV6:=1 USE_IPV6:=1
DEPSDIR?=/usr/local DEPSDIR?=/usr/local
@ -52,13 +51,6 @@ LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
ifndef USE_UPNP
override USE_UPNP = -
endif
ifneq (${USE_UPNP}, -)
LIBS += -l miniupnpc -l iphlpapi
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif
ifneq (${USE_IPV6}, -) ifneq (${USE_IPV6}, -)
DEFS += -DUSE_IPV6=$(USE_IPV6) DEFS += -DUSE_IPV6=$(USE_IPV6)

12
src/makefile.osx vendored

@ -2,11 +2,6 @@
# Distributed under the MIT/X11 software license, see the accompanying # Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# :=0 --> UPnP support turned off by default at runtime
# :=1 --> UPnP support turned on by default at runtime
# :=- --> No UPnP support - miniupnp not required
USE_UPNP:=1
# :=1 --> Enable IPv6 support # :=1 --> Enable IPv6 support
# :=0 --> Disable IPv6 support # :=0 --> Disable IPv6 support
USE_IPV6:=1 USE_IPV6:=1
@ -48,13 +43,6 @@ TESTLIBS += \
-l boost_unit_test_framework$(BOOST_LIB_SUFFIX) -l boost_unit_test_framework$(BOOST_LIB_SUFFIX)
# -Wl,-B$(LMODE) // does not work on OSX # -Wl,-B$(LMODE) // does not work on OSX
ifndef USE_UPNP
override USE_UPNP = -
endif
ifneq (${USE_UPNP}, -)
LIBS += -l miniupnpc
DEFS += -DUSE_UPNP=$(USE_UPNP)
endif
ifneq (${USE_IPV6}, -) ifneq (${USE_IPV6}, -)
DEFS += -DUSE_IPV6=$(USE_IPV6) DEFS += -DUSE_IPV6=$(USE_IPV6)

13
src/makefile.unix

@ -2,11 +2,6 @@
# Distributed under the MIT/X11 software license, see the accompanying # Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# :=0 --> UPnP support turned off by default at runtime
# :=1 --> UPnP support turned on by default at runtime
# :=- --> No UPnP support - miniupnp not required
USE_UPNP:=1
# :=1 --> Enable IPv6 support # :=1 --> Enable IPv6 support
# :=0 --> Disable IPv6 support # :=0 --> Disable IPv6 support
USE_IPV6:=1 USE_IPV6:=1
@ -48,14 +43,6 @@ TESTLIBS += \
-Wl,-B$(LMODE) \ -Wl,-B$(LMODE) \
-l boost_unit_test_framework$(BOOST_LIB_SUFFIX) -l boost_unit_test_framework$(BOOST_LIB_SUFFIX)
ifndef USE_UPNP
override USE_UPNP = -
endif
ifneq (${USE_UPNP}, -)
LIBS += -l miniupnpc
DEFS += -DUSE_UPNP=$(USE_UPNP)
endif
ifneq (${USE_IPV6}, -) ifneq (${USE_IPV6}, -)
DEFS += -DUSE_IPV6=$(USE_IPV6) DEFS += -DUSE_IPV6=$(USE_IPV6)
endif endif

8
src/twister.cpp

@ -254,8 +254,8 @@ void ThreadWaitExtIP()
std::string ipStr; std::string ipStr;
// wait up to 5 seconds for bitcoin to get the external IP // wait up to 10 seconds for bitcoin to get the external IP
for( int i = 0; i < 10; i++ ) { for( int i = 0; i < 20; i++ ) {
const CNetAddr paddrPeer("8.8.8.8"); const CNetAddr paddrPeer("8.8.8.8");
CAddress addr( GetLocalAddress(&paddrPeer) ); CAddress addr( GetLocalAddress(&paddrPeer) );
if( addr.IsValid() ) { if( addr.IsValid() ) {
@ -309,8 +309,10 @@ void ThreadWaitExtIP()
} }
if( !m_usingProxy ) { if( !m_usingProxy ) {
if( GetBoolArg("-upnp", true) ) {
ses->start_upnp(); ses->start_upnp();
ses->start_natpmp(); ses->start_natpmp();
}
ses->listen_on(std::make_pair(listen_port, listen_port) ses->listen_on(std::make_pair(listen_port, listen_port)
, ec, bind_to_interface.c_str()); , ec, bind_to_interface.c_str());
@ -334,7 +336,7 @@ void ThreadWaitExtIP()
} }
} }
session_settings settings; session_settings settings("twisterd/"+FormatFullVersion());
// settings to test local connections // settings to test local connections
settings.allow_multiple_connections_per_ip = true; settings.allow_multiple_connections_per_ip = true;
//settings.enable_outgoing_utp = false; // (false to see connections in netstat) //settings.enable_outgoing_utp = false; // (false to see connections in netstat)

17
twister-qt.pro

@ -58,23 +58,6 @@ contains(USE_QRCODE, 1) {
LIBS += -lqrencode LIBS += -lqrencode
} }
# use: qmake "USE_UPNP=1" ( enabled by default; default)
# or: qmake "USE_UPNP=0" (disabled by default)
# or: qmake "USE_UPNP=-" (not supported)
# miniupnpc (http://miniupnp.free.fr/files/) must be installed for support
contains(USE_UPNP, -) {
message(Building without UPNP support)
} else {
message(Building with UPNP support)
count(USE_UPNP, 0) {
USE_UPNP=1
}
DEFINES += USE_UPNP=$$USE_UPNP STATICLIB
INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH
LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc
win32:LIBS += -liphlpapi
}
# use: qmake "USE_DBUS=1" # use: qmake "USE_DBUS=1"
contains(USE_DBUS, 1) { contains(USE_DBUS, 1) {
message(Building with DBUS (Freedesktop notifications) support) message(Building with DBUS (Freedesktop notifications) support)

Loading…
Cancel
Save