});
this.on('close', function() {
- this._destroySSL();
+ // Make sure we are not doing it on OpenSSL's stack
+ setImmediate(destroySSL, this);
res = null;
});
return res;
};
+function destroySSL(self) {
+ self._destroySSL();
+}
+
TLSSocket.prototype._destroySSL = function _destroySSL() {
if (!this.ssl) return;
this.ssl.destroySSL();
return;
}
+ if (wrap->ssl_ == nullptr)
+ return;
+
// Commit
NodeBIO::FromBIO(wrap->enc_out_)->Read(nullptr, wrap->write_size_);
size_t count,
uv_stream_t* send_handle) {
CHECK_EQ(send_handle, nullptr);
+ CHECK_NE(ssl_, nullptr);
bool empty = true;
void TLSWrap::OnAllocImpl(size_t suggested_size, uv_buf_t* buf, void* ctx) {
TLSWrap* wrap = static_cast<TLSWrap*>(ctx);
+ if (wrap->ssl_ == nullptr) {
+ *buf = uv_buf_init(nullptr, 0);
+ return;
+ }
+
size_t size = 0;
buf->base = NodeBIO::FromBIO(wrap->enc_in_)->PeekWritable(&size);
buf->len = size;
void TLSWrap::EnableSessionCallbacks(
const FunctionCallbackInfo<Value>& args) {
TLSWrap* wrap = Unwrap<TLSWrap>(args.Holder());
+ if (wrap->ssl_ == nullptr) {
+ return wrap->env()->ThrowTypeError(
+ "EnableSessionCallbacks after destroySSL");
+ }
wrap->enable_session_callbacks();
NodeBIO::FromBIO(wrap->enc_in_)->set_initial(kMaxHelloLength);
wrap->hello_parser_.Start(SSLWrap<TLSWrap>::OnClientHello,