MCPcopy Create free account
hub / github.com/Snapchat/Valdi / lockFreeDoSend

Method lockFreeDoSend

valdi/src/valdi/runtime/Debugger/TCPConnectionImpl.cpp:65–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void TCPConnectionImpl::lockFreeDoSend() {
66 if (_pendingPackets.empty()) {
67 return;
68 }
69
70 auto bytes = _pendingPackets.front();
71
72 boost::asio::async_write(_socket,
73 boost::asio::buffer(bytes.data(), bytes.size()),
74 [strongSelf = strongSmallRef(this)](boost::system::error_code ec, std::size_t /*length*/) {
75 if (ec.failed()) {
76 strongSelf->close(errorFromBoostError(ec));
77 return;
78 }
79
80 std::lock_guard<Mutex> guard(strongSelf->_mutex);
81 if (strongSelf->_closed) {
82 return;
83 }
84 strongSelf->_pendingPackets.pop_front();
85 strongSelf->lockFreeDoSend();
86 });
87}
88
89void TCPConnectionImpl::close(const Error& error) {
90 Shared<ITCPConnectionDisconnectListener> listener;

Callers 1

submitDataMethod · 0.80

Calls 9

bufferFunction · 0.85
strongSmallRefFunction · 0.85
errorFromBoostErrorFunction · 0.85
frontMethod · 0.80
failedMethod · 0.80
closeMethod · 0.65
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected