Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
splitice committed Feb 20, 2024
1 parent ab49308 commit edf5851
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class Socket extends EventEmitter {
this.wrap.recv (this.buffer, function (buffer, bytes, source) {
const newBuffer = buffer.slice (0, bytes);
me.emit ("message", newBuffer, source, buffer);
return this.buffer
});
} catch (error) {
me.emit ("error", error);
Expand Down
6 changes: 5 additions & 1 deletion src/raw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,11 @@ NAN_METHOD(SocketWrap::Recv) {
addr[0] = 0; /* TODO */
argv[1] = Nan::New<Number>(rc);
argv[2] = Nan::New(addr).ToLocalChecked();
cb->Call (context, socket->handle(), argc, argv);
MaybeLocal<v8::Value> newBuffer = cb->Call (context, socket->handle(), argc, argv);
if (newBuffer.IsEmpty()) {
break;
}
buffer = newBuffer.ToLocalChecked()->ToObject(context).ToLocalChecked();
} while(true);

info.GetReturnValue().Set(info.This());
Expand Down

0 comments on commit edf5851

Please sign in to comment.