> On May 7, 2015, 5:40 p.m., Jie Yu wrote:
> > src/slave/http.cpp, lines 239-241
> > <https://reviews.apache.org/r/33935/diff/1/?file=952158#file952158line239>
> >
> > I think we usually put `?` and `:` in the end (similar to what we put `=` in
the end):
> >
> > ```
> > << (userAgent.isSome() ?
> > " with User-Agent='" + userAgent.get() + "'" :
> > "")
> > << (...)
> >
> > ```
> >
> > (BTW, I think you don't need `string(...)` above)
Really? I see a lot more cases of using it at the beginning, which I think is more readable
as well, fortunately :)
Also, I don't think it's similar to '=', since that only occurs once. This seems similar to
a conditional, which you're right, tends to go on the end. I had a comment about this here:
https://reviews.apache.org/r/23542/
Odd, I could have sworn it complained without string(), I'll remove it.
> On May 7, 2015, 5:40 p.m., Jie Yu wrote:
> > src/master/master.cpp, lines 732-735
> > <https://reviews.apache.org/r/33935/diff/1/?file=952157#file952157line732>
> >
> > Why do you need to capture `this`? Http::log is a static function, I don't think
you need to capture `this`.
> >
> > Capture `this` is in general dangeous because you want to make sure the callback
is invoked before this object is destructured. It's not obviously here that this is the case.
We need `http` which is a member variable. The last line is essentialy `return this->http.observe(request);`.
It's already being captured with the bind approach as `http` contains the `Master*` pointer.
Make sense? Alternatives you'd prefer?
> On May 7, 2015, 5:40 p.m., Jie Yu wrote:
> > src/master/master.cpp, lines 728-729
> > <https://reviews.apache.org/r/33935/diff/1/?file=952157#file952157line728>
> >
> > Just to be consistent, can you follow up with a patch to use lambda consistently
here?
Can you clarify this one? Are you saying don't use bind?
- Ben
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33935/#review82844
-----------------------------------------------------------
On May 7, 2015, 5:47 a.m., Ben Mahler wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/33935/
> -----------------------------------------------------------
>
> (Updated May 7, 2015, 5:47 a.m.)
>
>
> Review request for mesos, Jie Yu and Vinod Kone.
>
>
> Bugs: MESOS-2519
> https://issues.apache.org/jira/browse/MESOS-2519
>
>
> Repository: mesos
>
>
> Description
> -------
>
> This adds the client address, as well as user-agent and forwarding information, if present.
>
>
> Diffs
> -----
>
> src/master/http.cpp fb448256d7ced1f47ea48ccfca2ae267bc26ef94
> src/master/master.hpp 49ee050ca4d2b2c5f75ce864fcf6ae703dfdeadd
> src/master/master.cpp bee842557c8397428ca51e46faa182a391584be3
> src/slave/http.cpp f678aabdccd8c16e25c18ffb5075265ed8b76a70
> src/slave/slave.hpp 654a8698be88e0d0f588190775dc3eee6b36f92e
> src/slave/slave.cpp c78ee3c9e7fc38ad364e83f4abe267e86bfbbc13
>
> Diff: https://reviews.apache.org/r/33935/diff/
>
>
> Testing
> -------
>
> Tested manually:
>
> I0507 05:41:37.386196 28393 http.cpp:233] HTTP GET for /master/state.json from 127.0.0.1:5050
with User-Agent='curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3
libidn/0.6.5'
>
> I0507 05:42:34.905570 31000 http.cpp:237] HTTP GET for /slave(1)/state.json from 127.0.0.1:5051
with User-Agent='curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3
libidn/0.6.5'
>
>
> Thanks,
>
> Ben Mahler
>
>
|