Send message to socket.
ShutDown has been called before.
First writing.
Send message separatly.
ShutDown has been called before.
First writing.
Send message separatly.
178 {
179 int nWrote = 0;
180 size_t remaining = len;
181 bool faultError = false;
182
187 {
188 SPICES_CORE_ERROR("Disconnected, Can bot send message")
189 return;
190 }
191
196 {
197 nWrote = ::send(
m_Channel->Fd(), message, len, 0);
198 if (nWrote >= 0)
199 {
200 remaining = len - nWrote;
202 {
204 }
205 }
206 else
207 {
208 nWrote = 0;
209 const int err = WSAGetLastError();
210
211 if (err != WSAEWOULDBLOCK)
212 {
213 SPICES_CORE_ERROR(" TcpConnection::SendInLoop")
214
215 if (err == WSAECONNRESET || err == WSAECONNRESET)
216 {
217 faultError = true;
218 }
219 }
220 }
221 }
222
226 if (!faultError && remaining > 0)
227 {
230 {
232 }
235 {
237 }
238 }
239 }
size_t ReadableBytes() const
Get readable area bytes.
void Append(const std::string &msg)
Append Message to this buffer.
void QueueInLoop(Functor cb)
Execute functor in EventLoop thread.
std::atomic< State > m_State
TcpConnection state.
DelegateHighWaterMarkCallback m_HighWaterMarkCallback
DelegateHighWaterMarkCallback.
Buffer m_OutputBuffer
Output Buffer.
DelegateWriteCompleteCallback m_WriteCompleteCallback
DelegateWriteCompleteCallback.
std::unique_ptr< Channel > m_Channel
TcpConnection channel.
EventLoop * m_IoLoop
io Loop from TcpServer::NewConnection.
constexpr size_t HighWaterMark