mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
#1251 - add ipv6 address preference for NTCP/2, NTCP2 code clean
This commit is contained in:
parent
7c7742a175
commit
7ab29950a4
3 changed files with 170 additions and 153 deletions
|
@ -19,6 +19,10 @@
|
|||
#include "Event.h"
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#include <linux/in6.h>
|
||||
#endif
|
||||
|
||||
using namespace i2p::crypto;
|
||||
|
||||
namespace i2p
|
||||
|
@ -850,9 +854,14 @@ namespace transport
|
|||
try
|
||||
{
|
||||
m_NTCPV6Acceptor = new boost::asio::ip::tcp::acceptor (m_Service);
|
||||
m_NTCPV6Acceptor->open (boost::asio::ip::tcp::v6());
|
||||
m_NTCPV6Acceptor->open (boost::asio::ip::tcp::v6 ());
|
||||
m_NTCPV6Acceptor->set_option (boost::asio::ip::v6_only (true));
|
||||
m_NTCPV6Acceptor->set_option (boost::asio::socket_base::reuse_address (true));
|
||||
#ifndef WIN32
|
||||
// Set preference to use public IPv6 address -- works only on linux
|
||||
typedef boost::asio::detail::socket_option::boolean<IPV6_ADDR_PREFERENCES, IPV6_PREFER_SRC_PUBLIC> ipv6PreferPubAddr;
|
||||
m_NTCPV6Acceptor->set_option (ipv6PreferPubAddr (true));
|
||||
#endif
|
||||
m_NTCPV6Acceptor->bind (boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v6(), address->port));
|
||||
m_NTCPV6Acceptor->listen ();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue