Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
10.6.x.x (relative to 10.6.0.1)
========

Fixes
-----

- DisplayDriverServer : Fixed to support IPv4-only environments.

API
---

Expand Down
20 changes: 17 additions & 3 deletions src/IECoreImage/DisplayDriverServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,30 @@ class DisplayDriverServer::PrivateData : public RefCounted

void openPort( DisplayDriverServer::Port portNumber )
{
m_endpoint = boost::asio::ip::tcp::endpoint( tcp::v6(), portNumber );
m_acceptor.open( m_endpoint.protocol() );
boost::system::error_code errorCode;
tcp protocol = tcp::v6();
m_acceptor.open( protocol, errorCode );
if( !errorCode )
{
// Got IPv6. Allow v4 too.
m_acceptor.set_option( boost::asio::ip::v6_only( false ) );
}
else
{
// Fall back to IPv4 only.
m_acceptor.close();
protocol = tcp::v4();
m_acceptor.open( protocol );
}

#ifdef _MSC_VER
m_acceptor.set_option( boost::asio::ip::tcp::acceptor::reuse_address( false ) );
typedef boost::asio::detail::socket_option::boolean<BOOST_ASIO_OS_DEF( SOL_SOCKET ), SO_EXCLUSIVEADDRUSE> exclusive_address;
m_acceptor.set_option( exclusive_address( true ) );
#else
m_acceptor.set_option( boost::asio::ip::tcp::acceptor::reuse_address( true ) );
#endif
m_acceptor.set_option( boost::asio::ip::v6_only( false ) );
m_endpoint = boost::asio::ip::tcp::endpoint( protocol, portNumber );
m_acceptor.bind( m_endpoint );
m_acceptor.listen();
}
Expand Down