Skip to content

Commit

Permalink
Fix TcpSocket for Linux compilers (OpenRCT2#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
janisozaur authored and IntelOrca committed Jun 2, 2016
1 parent 8dfbabb commit e3d04ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/network/NetworkConnection.cpp
Expand Up @@ -16,7 +16,7 @@

#ifndef DISABLE_NETWORK

#include "Network.h"
#include "network.h"
#include "NetworkConnection.h"
#include "../core/String.hpp"
#include <SDL.h>
Expand Down
14 changes: 7 additions & 7 deletions src/network/TcpSocket.cpp
Expand Up @@ -74,7 +74,7 @@ class SocketException : public Exception

struct ConnectRequest
{
TcpSocket * TcpSocket;
TcpSocket * Socket;
std::string Address;
uint16 Port;
};
Expand Down Expand Up @@ -309,23 +309,23 @@ class TcpSocket : public ITcpSocket
{
// Spin off a worker thread for resolving the address
auto req = new ConnectRequest();
req->TcpSocket = this;
req->Socket = this;
req->Address = std::string(address);
req->Port = port;
SDL_CreateThread([](void * pointer) -> int
{
auto req = (ConnectRequest *)pointer;
try
{
req->TcpSocket->Connect(req->Address.c_str(), req->Port);
req->Socket->Connect(req->Address.c_str(), req->Port);
}
catch (Exception ex)
{
req->TcpSocket->_error = std::string(ex.GetMsg());
req->Socket->_error = std::string(ex.GetMsg());
}
delete req;
SDL_UnlockMutex(req->TcpSocket->_connectMutex);

SDL_UnlockMutex(req->Socket->_connectMutex);
return 0;
}, 0, req);
}
Expand Down Expand Up @@ -386,7 +386,7 @@ class TcpSocket : public ITcpSocket
}
}

void Close()
void Close() override
{
SDL_LockMutex(_connectMutex);
{
Expand Down

0 comments on commit e3d04ff

Please sign in to comment.