-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/63654/#review190444
-----------------------------------------------------------




3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 74 (patched)
<https://reviews.apache.org/r/63654/#comment267811>

    I am not sure such a function is useful in general; maybe consider adding 
it just as a lambda into `socketpair`.



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 82 (patched)
<https://reviews.apache.org/r/63654/#comment267810>

    We have no idea at this point which `close` failed.
    
    It seems we want to `map` `close` over an iterable of `int_fd`, each 
possibly creating an `Error`, and then possibly reduce all errors into a single 
`Error`, e.g.,
    
        // UNTESTED EXAMPLE.
        template <size_t N>
        Try<Nothing> close(const array<int_fd, N>& fds)
        {
          // Use stout's `close` to automatically capture errors.
          auto results = map(&close, fds);
          
          std::vector<Error> errors;
          foreach (auto&& result, results) {
            if (result.isError()) {
              errors.push_back(result.error());
            }
          }
          
          if (errors.empty()) {
            return Nothing();
          } else {
            return Error(strings::join("; ", errors));
          }
        }



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 89 (patched)
<https://reviews.apache.org/r/63654/#comment267807>

    Does it make sense to return a `Try<array<int_fd, 2>>` here for consistency 
with `os::pipe`?



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 94 (patched)
<https://reviews.apache.org/r/63654/#comment267812>

    I'd name this `result`, if only to be less brief.



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 101 (patched)
<https://reviews.apache.org/r/63654/#comment267808>

    If we'd change the return type, we'd be able to directly work in `s`.



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 131-132 (patched)
<https://reviews.apache.org/r/63654/#comment267817>

    Does it make sense to include this setup into this function? This function 
does not invoke `send`.



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 136 (patched)
<https://reviews.apache.org/r/63654/#comment267815>

    Could you insert linebreaks after `,`?



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 137 (patched)
<https://reviews.apache.org/r/63654/#comment267813>

    Any reason we don't just let the message from `strerror` with the current 
`errno` propagate automatically, `ErrnoError()`?



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 143 (patched)
<https://reviews.apache.org/r/63654/#comment267816>

    Ditto.



3rdparty/stout/include/stout/os/posix/socket.hpp
Lines 144 (patched)
<https://reviews.apache.org/r/63654/#comment267814>

    Ditto.


- Benjamin Bannier


On Nov. 8, 2017, 2:12 a.m., James Peach wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/63654/
> -----------------------------------------------------------
> 
> (Updated Nov. 8, 2017, 2:12 a.m.)
> 
> 
> Review request for mesos, Benjamin Bannier and Jie Yu.
> 
> 
> Bugs: MESOS-8156
>     https://issues.apache.org/jira/browse/MESOS-8156
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added a `net::socketpair` helper to stout that deals with
> automatically setting O_CLOEXEC and disabling SIGPIPE where
> necessary.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/os/posix/socket.hpp 
> bab0b808f53abd1314a7d13fc0cba75e5717f96f 
>   3rdparty/stout/tests/os/sendfile_tests.cpp 
> 05966ae067ae3972598da3370eb16fdce5736c21 
> 
> 
> Diff: https://reviews.apache.org/r/63654/diff/1/
> 
> 
> Testing
> -------
> 
> make check (Fedora 26, macOS)
> 
> 
> Thanks,
> 
> James Peach
> 
>

Reply via email to