We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64c8441 commit c06ea53Copy full SHA for c06ea53
src/muxer/yamux/yamux_stream.cpp
@@ -316,6 +316,8 @@ namespace libp2p::connection {
316
}
317
318
void YamuxStream::doClose(std::error_code ec, bool notify_read_side) {
319
+ // ensure lifetime of this object during doClose
320
+ auto self = shared_from_this();
321
if (close_reason_) {
322
// already closed
323
return;
@@ -343,10 +345,6 @@ namespace libp2p::connection {
343
345
VoidResultHandlerFunc window_size_cb;
344
346
window_size_cb.swap(window_size_cb_);
347
- // now we are detached from *this* and may be killed from inside callbacks
- // we will call
348
- auto self = shared_from_this();
349
-
350
if (read_cb_and_res.first) {
351
read_cb_and_res.first(read_cb_and_res.second);
352
0 commit comments