inspector: zero out structure members#8536
inspector: zero out structure members#8536eugeneo wants to merge 1 commit intonodejs:masterfrom eugeneo:zero_out
Conversation
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM. Maybe make the structs DISALLOW_COPY_AND_ASSIGN while you're here.
|
I've added DISALLOW_COPY_AND_ASSIGN. Then it showed that inspector socket instance needs a cleanup to be reused - so I decided that it would be best if inspector_accept did a reset, instead of expecting a clean instance. Please take another look. |
|
Sorry, forgot to run the linter. I uploaded a fixed version. |
src/inspector_socket.cc
Outdated
There was a problem hiding this comment.
This looks like it should be a inspector_socket_s method.
There was a problem hiding this comment.
Thank you for the review. I introduced the function... But that pushed the struct to class territory too far for me :)
I changed the struct to class, renamed it appropriately and added the namespace. In fairness, other inspector_* functions need to become member functions as well and the state needs to be made private, etc.
But I am currently working on a complex refactoring that will significantly change this class (I'm hoping to remove libuv interactions) so I don't see much value in doing a comprehensive change right now...
Please take a look at updated CL.
src/inspector_socket.cc
Outdated
There was a problem hiding this comment.
Maybe switch to static_cast while here?
src/inspector_socket.h
Outdated
src/inspector_socket.h
Outdated
There was a problem hiding this comment.
Can you drop the struct keywords?
test/cctest/test_inspector_socket.cc
Outdated
|
Thank you for the review. I updated the code, please take another look. |
Ctor has to be added as memset to 0 is no longer an option, since the structure now has std::vector member. Attemp at fixing #8155 (so far I was not able to repro it)
|
CI after rebase: https://ci.nodejs.org/job/node-test-pull-request/4159/ |
|
Thanks, landed as bc1ebd6. |
Ctor has to be added as memset to 0 is no longer an option, since the structure now has std::vector member. Attempt at fixing nodejs#8155 (so far I was not able to repro it) PR-URL: nodejs#8536 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
Change is internal to inspector.
Description of change
Ctor has to be added as memset to 0 is no longer an option, since
the structure now has std::vector member.
This is an attempt at guessing a fix for #8155 - so far I was not able to repro it.