-
Notifications
You must be signed in to change notification settings - Fork 818
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
TS-4697: free MIOBuffer if fails on ipallow check. #823
Conversation
Due to multi types of SessionAccept, I'm change the return type of SessionAccept::accept() from void to int and free the MIOBuffer in ProtocolProbeTrampoline::ioCompletionEvent(). EVENT_DONE : ip allow check fails or forbidden, the caller should free MIOBuffer. |
Certainly seems reasonable to me. [approve ci] |
Linux build failed! See https://ci.trafficserver.apache.org/job/Github-Linux/373/ for details. |
@oknet This failed clang-format, please fix and push update :). |
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/476/ for details. |
clang-format fixed. @zwoop |
We don't really use event return values outside of event handlers, so if we return a failure from Originally, the contract for |
@jpeach SessionAccept is a interface to create ClientSession. Its mutex is NULL, it is not safe to release any resource. The caller to SessionAccept is Trampline that mutex is copy from NetVC, it is safe to handle resource release. This is why I'm free MIOBuffer in Trampline. |
You don't need to hold a mutex to free anything. In all of these cases, the callee is supposed to consume both parameters. For consistency, we should not sometime consume only some of the parameters. |
@jpeach agree with u to return bool from SessionAccept::accept(). SessionAccept did not consume any parameters, It is just transfer parameters to ClientSession. Just return false if ipallow check fails in XXXSessionAccept::accept(). |
Thanks @oknet. Can you please document the invariants for |
@jpeach Do you means L175 ~ L184 in proxy/http/HttpSessionAccept.h ?
Just copy the comment from HttpSessionAccept.h to I_SessionAccept.h maybe with minor changes ? |
Yeh that sounds reasonable. I'd like the comment to give accurate information about when the arguments need to be deleted and when the callee takes ownership. |
|
||
So a NULL mutex is safe to continuation. | ||
*/ | ||
|
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.
@jpeach comments added, please review.
[approve ci] |
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/556/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/452/ for details. |
No description provided.