close method
Implementation
Future<void> close() async {
await shutdown();
final subscription = _subscription;
_subscription = null;
await subscription?.cancel();
final socket = _socket;
if (socket != null && !_socketClosed) {
await socket.flush();
await socket.close();
_socketClosed = true;
}
final ssl = _ssl;
if (ssl != null && ssl != ffi.nullptr) {
_openSsl.SSL_free(ssl);
_ssl = null;
_networkReadBio = null;
_networkWriteBio = null;
}
final ctx = _ctx;
if (ctx != null && ctx != ffi.nullptr) {
_openSsl.SSL_CTX_free(ctx);
_ctx = null;
}
_ciphertextQueue.clear();
final signal = _ciphertextSignal;
if (signal != null && !signal.isCompleted) {
signal.complete();
}
_ciphertextSignal = null;
}