summaryrefslogtreecommitdiff
path: root/src/stream_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream_base.cc')
-rw-r--r--src/stream_base.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/stream_base.cc b/src/stream_base.cc
index bb25fc1cff..a48e77063e 100644
--- a/src/stream_base.cc
+++ b/src/stream_base.cc
@@ -193,7 +193,8 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) {
}
err = DoWrite(req_wrap, buf_list, count, nullptr);
- req_wrap_obj->Set(env->async(), True(env->isolate()));
+ if (HasWriteQueue())
+ req_wrap_obj->Set(env->async(), True(env->isolate()));
if (err)
req_wrap->Dispose();
@@ -249,7 +250,8 @@ int StreamBase::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
req_wrap = WriteWrap::New(env, req_wrap_obj, this);
err = DoWrite(req_wrap, bufs, count, nullptr);
- req_wrap_obj->Set(env->async(), True(env->isolate()));
+ if (HasWriteQueue())
+ req_wrap_obj->Set(env->async(), True(env->isolate()));
req_wrap_obj->Set(env->buffer_string(), args[1]);
if (err)
@@ -373,7 +375,8 @@ int StreamBase::WriteString(const FunctionCallbackInfo<Value>& args) {
reinterpret_cast<uv_stream_t*>(send_handle));
}
- req_wrap_obj->Set(env->async(), True(env->isolate()));
+ if (HasWriteQueue())
+ req_wrap_obj->Set(env->async(), True(env->isolate()));
if (err)
req_wrap->Dispose();
@@ -467,6 +470,10 @@ int StreamResource::DoTryWrite(uv_buf_t** bufs, size_t* count) {
return 0;
}
+bool StreamResource::HasWriteQueue() {
+ return true;
+}
+
const char* StreamResource::Error() const {
return nullptr;