-
Notifications
You must be signed in to change notification settings - Fork 844
CID 1516688: Fix uninitialized member of AcceptOptions #10152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
[approve ci freebsd] |
iocore/net/AcceptOptions.h
Outdated
| int accept_threads = -1; | ||
| /// Event type to generate on accept. | ||
| EventType etype; | ||
| EventType etype = ET_NET; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could remove this (and not have to include "I_Net.h") because it is never set to anything other than ET_NET.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I don't see it being set to anything else. You could get rid of the member variable and just use ET_NET in the code.
NetAccept::opt.etype is set to 0 in both NetAccept::do_blocking_accept() and NetAccept::acceptFastEvent() when setting ts.accept_thread to either 1 or 0 respectively.
iocore/net/AcceptOptions.h
Outdated
| #include "tscore/ink_inet.h" | ||
|
|
||
| #include "I_Event.h" | ||
| #include "I_Net.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this bring a lot of dependency? I think that's the reason we have AcceptOptions.cc separately.
@moonchen What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to think about I_Net.h. @bryancall and some others are going to look into it.
|
I'm for hard-coding the etype to ET_NET. If we want to keep it as a variable, I suggest we pass in etype from the constructor of AcceptOptions so that ET_NET is not a dependency of AcceptOptions. |
35f7896 to
059df6a
Compare
|
Removed |
* asf/master: (22 commits) fix: check whether a protocol is enabled during the length calculation in create_npn_advertisement (apache#10381) Coverity 1518612: Remove dead code (apache#10384) prefetch_cmcd: make autests more robust by removing need for gold file wildcard (apache#10382) Give a chance to send a response before receiving next request on H2 (apache#9997) CID 1516688: Fix uninitialized member of AcceptOptions (apache#10152) Fix slice head request memory issue (apache#10285) Fixes the TSMgmt metrics APIs for new API metrics (apache#10379) Minor parent.config a/an change (apache#10372) Allow DbgCtl tag to be set after instance construction. (apache#10375) Fix more build dep issues, for later PRs to work (apache#10376) money_trace cid 1518569: string not null terminated (apache#10373) Fix a couple of Coverity issues in health check plugin, around filenames (apache#10371) Fixes some build issues that happens with other changes (apache#10374) Eliminate unreachable code covered by switch default (apache#10370) Add tests for disk failure (apache#10192) Disable copying/moving for DbgCtl. (apache#10321) Cmake autest (apache#10327) cmake: add unit tests from mgmt/rpc (apache#10366) Adjust CMakeLists with git worktree (apache#10298) Fix example plugins build (apache#10326) ...
Fix #10013
Update:
Cleanup AcceptOptions
reset()function, because it's only called by the constructor.reset()function only.IpAddr local_ipis an exception. Callinginvalidate()is the same as the initialization ofIpAddr.trafficserver/include/tscore/ink_inet.h
Lines 1302 to 1308 in f9aa1e0
trafficserver/include/tscore/ink_inet.h
Line 1317 in f9aa1e0