Skip to content

Commit 7a8fc9d

Browse files
committed
correction close transport
1 parent b220bfd commit 7a8fc9d

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/TcpTransport.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,14 @@ class AsyncTcpTransport : public AsyncTransport {
6565
}
6666
void close(bool now = false) override {
6767
(void)now;
68-
if (_client)
68+
if (_client) {
69+
_client->onConnect(nullptr, nullptr);
70+
_client->onData(nullptr, nullptr);
71+
_client->onDisconnect(nullptr, nullptr);
72+
_client->onError(nullptr, nullptr);
73+
_client->onTimeout(nullptr, nullptr);
6974
_client->close();
75+
}
7076
}
7177
bool isSecure() const override {
7278
return false;

src/TlsTransport.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ bool AsyncTlsTransport::canSend() const {
429429

430430
void AsyncTlsTransport::close(bool now) {
431431
(void)now;
432+
if (_client) {
433+
_client->onConnect(nullptr, nullptr);
434+
_client->onData(nullptr, nullptr);
435+
_client->onDisconnect(nullptr, nullptr);
436+
_client->onError(nullptr, nullptr);
437+
_client->onTimeout(nullptr, nullptr);
438+
}
432439
if (_state == State::Established) {
433440
mbedtls_ssl_close_notify(&_ssl);
434441
}

0 commit comments

Comments
 (0)