GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — net: fix crash if POLLHUP is received · nodejs/node@ff5ab6f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • stream_base.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/stream_base.cc‎

Copy file name to clipboardExpand all lines: src/stream_base.cc
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,13 +508,21 @@ uv_buf_t CustomBufferJSListener::OnStreamAlloc(size_t suggested_size) {
508508

509509
void CustomBufferJSListener::OnStreamRead(ssize_t nread, const uv_buf_t& buf) {
510510
CHECK_NOT_NULL(stream_);
511-
CHECK_EQ(buf.base, buffer_.base);
512511

513512
StreamBase* stream = static_cast<StreamBase*>(stream_);
514513
Environment* env = stream->stream_env();
515514
HandleScope handle_scope(env->isolate());
516515
Context::Scope context_scope(env->context());
517516

517+
// To deal with the case where POLLHUP is received and UV_EOF is returned, as
518+
// libuv returns an empty buffer (on unices only).
519+
if (nread == UV_EOF && buf.base == nullptr) {
520+
stream->CallJSOnreadMethod(nread, Local<ArrayBuffer>());
521+
return;
522+
}
523+
524+
CHECK_EQ(buf.base, buffer_.base);
525+
518526
MaybeLocal<Value> ret = stream->CallJSOnreadMethod(nread,
519527
Local<ArrayBuffer>(),
520528
0,

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.