summaryrefslogtreecommitdiff
path: root/src/tls_wrap.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-12-09 05:29:11 +0100
committerAnna Henningsen <anna@addaleax.net>2017-12-13 06:45:57 +0100
commit453008d73ef7248c809d4d1b52c127915b08fc46 (patch)
treeecccf51cbe93e3efbe48a42fde6ccb0fa495d9bf /src/tls_wrap.h
parent24b0f67c2b0b97a4b79f9582e805785cb317daa0 (diff)
downloadandroid-node-v8-453008d73ef7248c809d4d1b52c127915b08fc46.tar.gz
android-node-v8-453008d73ef7248c809d4d1b52c127915b08fc46.tar.bz2
android-node-v8-453008d73ef7248c809d4d1b52c127915b08fc46.zip
src: minor refactoring to StreamBase writes
Instead of having per-request callbacks, always call a callback on the `StreamBase` instance itself for `WriteWrap` and `ShutdownWrap`. This makes `WriteWrap` cleanup consistent for all stream classes, since the after-write callback is always the same now. If special handling is needed for writes that happen to a sub-class, `AfterWrite` can be overridden by that class, rather than that class providing its own callback (e.g. updating the write queue size for libuv streams). If special handling is needed for writes that happen on another stream instance, the existing `after_write_cb()` callback is used for that (e.g. custom code after writing to the transport from a TLS stream). As a nice bonus, this also makes `WriteWrap` and `ShutdownWrap` instances slightly smaller. PR-URL: https://github.com/nodejs/node/pull/17564 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/tls_wrap.h')
-rw-r--r--src/tls_wrap.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tls_wrap.h b/src/tls_wrap.h
index edd21cf1cf..87eac75779 100644
--- a/src/tls_wrap.h
+++ b/src/tls_wrap.h
@@ -111,7 +111,7 @@ class TLSWrap : public AsyncWrap,
static void SSLInfoCallback(const SSL* ssl_, int where, int ret);
void InitSSL();
void EncOut();
- static void EncOutCb(WriteWrap* req_wrap, int status);
+ void EncOutAfterWrite(WriteWrap* req_wrap, int status);
bool ClearIn();
void ClearOut();
void MakePending();
@@ -134,7 +134,7 @@ class TLSWrap : public AsyncWrap,
uint32_t UpdateWriteQueueSize(uint32_t write_queue_size = 0);
// Resource implementation
- static void OnAfterWriteImpl(WriteWrap* w, void* ctx);
+ static void OnAfterWriteImpl(WriteWrap* w, int status, void* ctx);
static void OnAllocImpl(size_t size, uv_buf_t* buf, void* ctx);
static void OnReadImpl(ssize_t nread,
const uv_buf_t* buf,