mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
Don't disable SO_REUSEADDR on non-Windows, where it is safe.
This commit is contained in:
parent
17e753faf3
commit
cf4d015b2a
14
Externals/SFML/src/SFML/Network/SocketTCP.cpp
vendored
14
Externals/SFML/src/SFML/Network/SocketTCP.cpp
vendored
@ -488,18 +488,22 @@ void SocketTCP::Create(SocketHelper::SocketType Descriptor)
|
|||||||
// Setup default options
|
// Setup default options
|
||||||
if (IsValid())
|
if (IsValid())
|
||||||
{
|
{
|
||||||
/* We must disable this in order to detect if ports are being used by other apps, or
|
int Yes = 1;
|
||||||
other instances of dolphin. This is also disabled in SFML 2.0, see
|
#ifndef SFML_SYSTEM_WINDOWS
|
||||||
http://www.sfml-dev.org/forum/viewtopic.php?t=3388
|
/* We must disable this in order to detect if ports are being used by other apps, or
|
||||||
|
other instances of dolphin. This is also disabled in SFML 2.0, see
|
||||||
|
http://www.sfml-dev.org/forum/viewtopic.php?t=3388
|
||||||
|
...In fact, SO_REUSEADDR is only unsafe on Windows. See:
|
||||||
|
http://stackoverflow.com/questions/14388706
|
||||||
|
*/
|
||||||
// To avoid the "Address already in use" error message when trying to bind to the same port
|
// To avoid the "Address already in use" error message when trying to bind to the same port
|
||||||
if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&Yes), sizeof(Yes)) == -1)
|
if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&Yes), sizeof(Yes)) == -1)
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to set socket option \"SO_REUSEADDR\" ; "
|
std::cerr << "Failed to set socket option \"SO_REUSEADDR\" ; "
|
||||||
<< "binding to a same port may fail if too fast" << std::endl;
|
<< "binding to a same port may fail if too fast" << std::endl;
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
int Yes = 1;
|
|
||||||
// Disable the Nagle algorithm (ie. removes buffering of TCP packets)
|
// Disable the Nagle algorithm (ie. removes buffering of TCP packets)
|
||||||
if (setsockopt(mySocket, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&Yes), sizeof(Yes)) == -1)
|
if (setsockopt(mySocket, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&Yes), sizeof(Yes)) == -1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user