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 1
1
10.6.x.x (relative to 10.6.0.1)
2
2
========
3
3
4
+ Fixes
5
+ -----
6
+
7
+ - DisplayDriverServer : Fixed to support IPv4-only environments.
8
+
4
9
API
5
10
---
6
11
Original file line number Diff line number Diff line change @@ -189,16 +189,30 @@ class DisplayDriverServer::PrivateData : public RefCounted
189
189
190
190
void openPort ( DisplayDriverServer::Port portNumber )
191
191
{
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
+
194
208
#ifdef _MSC_VER
195
209
m_acceptor.set_option ( boost::asio::ip::tcp::acceptor::reuse_address ( false ) );
196
210
typedef boost::asio::detail::socket_option::boolean<BOOST_ASIO_OS_DEF ( SOL_SOCKET ), SO_EXCLUSIVEADDRUSE> exclusive_address;
197
211
m_acceptor.set_option ( exclusive_address ( true ) );
198
212
#else
199
213
m_acceptor.set_option ( boost::asio::ip::tcp::acceptor::reuse_address ( true ) );
200
214
#endif
201
- m_acceptor. set_option ( boost::asio::ip::v6_only ( false ) );
215
+ m_endpoint = boost::asio::ip::tcp::endpoint ( protocol, portNumber );
202
216
m_acceptor.bind ( m_endpoint );
203
217
m_acceptor.listen ();
204
218
}
You can’t perform that action at this time.
0 commit comments