summaryrefslogtreecommitdiffstats
path: root/source/OSSupport/SocketThreads.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-05 10:53:29 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-05 10:53:29 +0100
commit9d2c841843bfe91f8479fdc06b5091f666099028 (patch)
tree5c4e62df8406f865ac2375caca338c10bfccceee /source/OSSupport/SocketThreads.cpp
parentMoved client socket accepting into a separate thread object, cListenThread (diff)
downloadcuberite-9d2c841843bfe91f8479fdc06b5091f666099028.tar
cuberite-9d2c841843bfe91f8479fdc06b5091f666099028.tar.gz
cuberite-9d2c841843bfe91f8479fdc06b5091f666099028.tar.bz2
cuberite-9d2c841843bfe91f8479fdc06b5091f666099028.tar.lz
cuberite-9d2c841843bfe91f8479fdc06b5091f666099028.tar.xz
cuberite-9d2c841843bfe91f8479fdc06b5091f666099028.tar.zst
cuberite-9d2c841843bfe91f8479fdc06b5091f666099028.zip
Diffstat (limited to 'source/OSSupport/SocketThreads.cpp')
-rw-r--r--source/OSSupport/SocketThreads.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/source/OSSupport/SocketThreads.cpp b/source/OSSupport/SocketThreads.cpp
index 943293f5c..e7061ed31 100644
--- a/source/OSSupport/SocketThreads.cpp
+++ b/source/OSSupport/SocketThreads.cpp
@@ -427,13 +427,13 @@ bool cSocketThreads::cSocketThread::QueueClose(const cCallback * a_Client)
bool cSocketThreads::cSocketThread::Start(void)
{
// Create the control socket listener
- m_ControlSocket2 = cSocket::CreateSocket();
+ m_ControlSocket2 = cSocket::CreateSocket(cSocket::IPv4);
if (!m_ControlSocket2.IsValid())
{
LOGERROR("Cannot create a Control socket for a cSocketThread (\"%s\"); continuing, but server may be unreachable from now on.", cSocket::GetLastErrorString().c_str());
return false;
}
- if (m_ControlSocket2.BindToLocalhost(cSocket::ANY_PORT) != 0)
+ if (m_ControlSocket2.BindToLocalhostIPv4(cSocket::ANY_PORT) != 0)
{
LOGERROR("Cannot bind a Control socket for a cSocketThread (\"%s\"); continuing, but server may be unreachable from now on.", cSocket::GetLastErrorString().c_str());
m_ControlSocket2.CloseSocket();
@@ -481,13 +481,9 @@ bool cSocketThreads::cSocketThread::Start(void)
void cSocketThreads::cSocketThread::Execute(void)
{
// Connect the "client" part of the Control socket:
- m_ControlSocket1 = cSocket::CreateSocket();
- cSocket::SockAddr_In Addr;
- Addr.Family = cSocket::ADDRESS_FAMILY_INTERNET;
- Addr.Address = cSocket::INTERNET_ADDRESS_LOCALHOST();
- Addr.Port = m_ControlSocket2.GetPort();
- ASSERT(Addr.Port != 0); // We checked in the Start() method, but let's be sure
- if (m_ControlSocket1.Connect(Addr) != 0)
+ m_ControlSocket1 = cSocket::CreateSocket(cSocket::IPv4);
+ ASSERT(m_ControlSocket2.GetPort() != 0); // We checked in the Start() method, but let's be sure
+ if (!m_ControlSocket1.ConnectToLocalhostIPv4(m_ControlSocket2.GetPort()))
{
LOGERROR("Cannot connect Control sockets for a cSocketThread (\"%s\"); continuing, but the server may be unreachable from now on.", cSocket::GetLastErrorString().c_str());
m_ControlSocket2.CloseSocket();