SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Send()

void Spices::Net::TcpConnection::Send ( const std::string & buffer)

Send message to socket.

Parameters
[in]bufferData.

Definition at line 49 of file TcpConnection.cpp.

50 {
51 if (m_State.load() == State::Connected)
52 {
54 {
55 SendInLoop(buffer.c_str(), buffer.size());
56 }
57 else
58 {
59 m_IoLoop->RunInLoop([=]() { SendInLoop(buffer.c_str(), buffer.size()); });
60 }
61 }
62 }
bool IsInLoopThread() const
Determine if current thread is in eventloop thread.
Definition EventLoop.h:109
void RunInLoop(Functor cb)
Push functor to pending functors.
Definition EventLoop.cpp:79
std::atomic< State > m_State
TcpConnection state.
void SendInLoop(const char *message, size_t len)
Send message to socket.
EventLoop * m_IoLoop
io Loop from TcpServer::NewConnection.

References Spices::Net::EventLoop::IsInLoopThread(), and m_IoLoop.