Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/network/NetworkConnection.cpp
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SocketException : public Exception

struct ConnectRequest
{
TcpSocket * TcpSocket;
TcpSocket * Socket;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? I don't want any confusion between TcpSocket and SOCKET.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be TCPSocket or MySocket or anything else, as long as it is not TcpSocket.

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