Skip to content

Commit fae0af7

Browse files
authored
Fix closeOnError: call cb() before close() (#293)
* closeOnError: call cb() before close() Signed-off-by: Igor Egorov <[email protected]> * Countable yamux and yamux read buffer * Count yamux metrics forcefully * Revert "Count yamux metrics forcefully" This reverts commit 88cdeed. * Revert "Countable yamux and yamux read buffer" This reverts commit e171915. --------- Signed-off-by: Igor Egorov <[email protected]>
1 parent ef43be4 commit fae0af7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/security/tls/tls_connection.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ namespace libp2p::connection {
132132
auto &&result) {
133133
if (ec) {
134134
SL_DEBUG(log(), "connection async op error {}", ec);
135+
cb(ec);
135136
std::ignore = conn->close();
136-
return cb(ec);
137+
return;
137138
}
138139
cb(std::forward<decltype(result)>(result));
139140
};

src/transport/tcp/tcp_connection.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ namespace libp2p::transport {
9595
auto result) {
9696
if (auto self = wptr.lock()) {
9797
if (ec) {
98+
cb(ec);
9899
self->close(ec);
99-
return cb(ec);
100+
return;
100101
}
101102
TRACE("{} {}", self->str(), result);
102103
cb(result);

0 commit comments

Comments
 (0)