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

Method doRead

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

Source from the content-addressed store, hash-verified

153}
154
155void TCPConnectionImpl::doRead() {
156 auto buffer = Valdi::makeShared<Buffer>();
157 _socket.async_read_some(
158 boost::asio::buffer(buffer->data(), buffer->size()),
159 [buffer, strongSelf = strongSmallRef(this)](boost::system::error_code ec, std::size_t length) {
160 if (ec.failed()) {
161 strongSelf->close(errorFromBoostError(ec));
162 } else {
163 {
164 std::lock_guard<Mutex> guard(strongSelf->_mutex);
165 if (strongSelf->_closed) {
166 return;
167 }
168 strongSelf->doRead();
169 }
170
171 auto listener = strongSelf->getDataListener();
172 if (listener != nullptr) {
173 listener->onDataReceived(strongSelf, BytesView(buffer, buffer->data(), length));
174 }
175 }
176 });
177}
178
179void TCPConnectionImpl::onReady() {
180 _address = resolveAddress();

Callers

nothing calls this directly

Calls 10

bufferFunction · 0.85
strongSmallRefFunction · 0.85
errorFromBoostErrorFunction · 0.85
failedMethod · 0.80
BytesViewClass · 0.70
closeMethod · 0.65
dataMethod · 0.45
sizeMethod · 0.45
getDataListenerMethod · 0.45
onDataReceivedMethod · 0.45

Tested by

no test coverage detected