Skip to content

Commit fc02b0c

Browse files
committed
closeOnError: call cb() before close()
Signed-off-by: Igor Egorov <[email protected]>
1 parent ef43be4 commit fc02b0c

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)