File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 1110.6.x.x (relative to 10.6.0.1)
22========
33
4+ Fixes
5+ -----
6+
7+ - DisplayDriverServer : Fixed to support IPv4-only environments.
8+
49API
510---
611
Original file line number Diff line number Diff line change @@ -189,16 +189,30 @@ class DisplayDriverServer::PrivateData : public RefCounted
189189
190190 void openPort ( DisplayDriverServer::Port portNumber )
191191 {
192- m_endpoint = boost::asio::ip::tcp::endpoint ( tcp::v6 (), portNumber );
193- m_acceptor.open ( m_endpoint.protocol () );
192+ boost::system::error_code errorCode;
193+ tcp protocol = tcp::v6 ();
194+ m_acceptor.open ( protocol, errorCode );
195+ if ( !errorCode )
196+ {
197+ // Got IPv6. Allow v4 too.
198+ m_acceptor.set_option ( boost::asio::ip::v6_only ( false ) );
199+ }
200+ else
201+ {
202+ // Fall back to IPv4 only.
203+ m_acceptor.close ();
204+ protocol = tcp::v4 ();
205+ m_acceptor.open ( protocol );
206+ }
207+
194208#ifdef _MSC_VER
195209 m_acceptor.set_option ( boost::asio::ip::tcp::acceptor::reuse_address ( false ) );
196210 typedef boost::asio::detail::socket_option::boolean<BOOST_ASIO_OS_DEF ( SOL_SOCKET ), SO_EXCLUSIVEADDRUSE> exclusive_address;
197211 m_acceptor.set_option ( exclusive_address ( true ) );
198212#else
199213 m_acceptor.set_option ( boost::asio::ip::tcp::acceptor::reuse_address ( true ) );
200214#endif
201- m_acceptor. set_option ( boost::asio::ip::v6_only ( false ) );
215+ m_endpoint = boost::asio::ip::tcp::endpoint ( protocol, portNumber );
202216 m_acceptor.bind ( m_endpoint );
203217 m_acceptor.listen ();
204218 }
You can’t perform that action at this time.
0 commit comments