summaryrefslogtreecommitdiff
path: root/src/tls_wrap.h
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2014-02-14 17:01:34 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2014-02-18 01:07:09 +0400
commit75ea11fc08019bb1ffac81583ed7d0da3241a5b5 (patch)
treea93575a064c35f8ced63c1dcb34f0e6af8ff6d77 /src/tls_wrap.h
parenta4436bab7b83e311f8a4207b9c6d97acde4735ff (diff)
downloadnode-new-75ea11fc08019bb1ffac81583ed7d0da3241a5b5.tar.gz
tls: introduce asynchronous `newSession`
fix #7105
Diffstat (limited to 'src/tls_wrap.h')
-rw-r--r--src/tls_wrap.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/tls_wrap.h b/src/tls_wrap.h
index 946cc1c64d..646e70108f 100644
--- a/src/tls_wrap.h
+++ b/src/tls_wrap.h
@@ -102,11 +102,18 @@ class TLSCallbacks : public crypto::SSLWrap<TLSCallbacks>,
void ClearOut();
void MakePending();
bool InvokeQueued(int status);
+ void NewSessionDoneCb();
inline void Cycle() {
- ClearIn();
- ClearOut();
- EncOut();
+ // Prevent recursion
+ if (++cycle_depth_ > 1)
+ return;
+
+ for (; cycle_depth_ > 0; cycle_depth_--) {
+ ClearIn();
+ ClearOut();
+ EncOut();
+ }
}
v8::Local<v8::Value> GetSSLError(int status, int* err, const char** msg);
@@ -144,6 +151,7 @@ class TLSCallbacks : public crypto::SSLWrap<TLSCallbacks>,
bool established_;
bool shutdown_;
const char* error_;
+ int cycle_depth_;
// If true - delivered EOF to the js-land, either after `close_notify`, or
// after the `UV_EOF` on socket.
@@ -155,6 +163,8 @@ class TLSCallbacks : public crypto::SSLWrap<TLSCallbacks>,
static size_t error_off_;
static char error_buf_[1024];
+
+ friend class SSLWrap<TLSCallbacks>;
};
} // namespace node