Skip to content

Commit

Permalink
Throw runtime_error in SimpleSocketSender instead of dummy socket for…
Browse files Browse the repository at this point in the history
… non-TCP protocol.
  • Loading branch information
mirasrael committed Jan 3, 2024
1 parent e43442d commit 50bc047
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions rd-cpp/thirdparty/clsocket/src/SimpleSocketSender.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ class CSimpleSocketSender
public:
explicit CSimpleSocketSender(const std::shared_ptr<CSimpleSocket>& socket) : m_error(CSimpleSocket::SocketSuccess)
{
if (socket->m_nSocketType == CSimpleSocket::CSocketType::SocketTypeTcp)
m_socket = socket;
else
m_socket = std::make_shared<CSimpleSocket>();
if (socket->m_nSocketType != CSimpleSocket::CSocketType::SocketTypeTcp)
throw std::runtime_error("Only TCP sockets are supported");
m_socket = socket;
}

int32_t Send(const uint8_t* pBuf, size_t bytesToSend) const;
Expand Down
2 changes: 0 additions & 2 deletions rd-cpp/thirdparty/clsocket/src/StatTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@

#include "Host.h"

#include <algorithm>

#if defined(_WIN32)
#define GET_CLOCK_COUNT(x) QueryPerformanceCounter((LARGE_INTEGER *)x)
#else
Expand Down

0 comments on commit 50bc047

Please sign in to comment.