mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Peach <jpe...@apache.org>
Subject Re: Review Request 53460: Refactored network::Address into inet::Address.
Date Sun, 20 Nov 2016 23:31:23 GMT

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




3rdparty/libprocess/include/process/address.hpp (line 124)
<https://reviews.apache.org/r/53460/#comment226632>

    Suggest that this should be `explicit`. There's some risk that strings like `127.0.0.1`
would be coverted implicitly, whereas if you have to explicitly convert to `unix::Address`
this is unlikely.



3rdparty/libprocess/include/process/address.hpp (line 133)
<https://reviews.apache.org/r/53460/#comment226630>

    You should bounds-check the path here since, `sun_path` is only 108 bytes.



3rdparty/libprocess/include/process/address.hpp (line 224)
<https://reviews.apache.org/r/53460/#comment226631>

    My usual pattern for dealing with socket addresses is to use a union, which avoids the
fiddly memory copies and casting. For example:
    ```
    union {
      sockaddr sa;
      sockaddr_storage storage;
      sockaddr_in sin;
      sockaddr_in6 sin6;
      sockaddr_un sun;
    } addr = {0};
    
    addr.sin.sin_family = AF_INET;
    addr.sin.sin_addr = ip.in().get();
    addr.sin.sin_port = htons(port);
    return network::Address(addr.storage);
    ```
    
    This union helps in lots of places to make code cleaner and to avoid explicit casting.
    
    I'm not a fan of building APIs that accept `sockaddr_storage`, since that is what `sockaddr`
is for, but that could jut be a matter of taste :)



3rdparty/libprocess/include/process/address.hpp (line 257)
<https://reviews.apache.org/r/53460/#comment226633>

    The number of temporary copies here seems a little infortunate when we could arrange for
something like this to work:
    
    ```
    if (address->family() == UNIX) {
      const sockaddr *sa = addr->sockaddr();
      return unix::Address(sa);
    }
    ```


- James Peach


On Nov. 4, 2016, 5:30 p.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53460/
> -----------------------------------------------------------
> 
> (Updated Nov. 4, 2016, 5:30 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Jie Yu.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Also added unix::Address.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/Makefile.am 71319891a451bd1d565210dcce2fb61fc69e1f61 
>   3rdparty/libprocess/include/process/address.hpp 04e3155d65f476208fa852e83b79d173b66288fd

>   3rdparty/libprocess/include/process/network.hpp 52110667185370a4c92e2fa524819ab1f34bdec9

>   3rdparty/libprocess/include/process/socket.hpp f798af7879546d71e8ef4a295c9cf489a70cb61f

>   3rdparty/libprocess/include/process/ssl/gtest.hpp 21a0fc45b55a368a21b3e616c751ab43eebd4902

>   3rdparty/libprocess/src/address.cpp PRE-CREATION 
>   3rdparty/libprocess/src/libevent_ssl_socket.cpp 21f878ee81db32ad35878ec053c3f2de3637196c

>   3rdparty/libprocess/src/poll_socket.cpp f0ee1490e6fccb038f64a27b2c71458ad5b5e5a1 
>   3rdparty/libprocess/src/process.cpp ab2b5a9d38a3001d6a5daa1807fecb630c4b154d 
>   3rdparty/libprocess/src/socket.cpp 7f93168e1572f8669f67a4c5e6e5467259b7a407 
>   3rdparty/libprocess/src/tests/socket_tests.cpp PRE-CREATION 
>   3rdparty/libprocess/src/tests/ssl_tests.cpp 55c8c309571b1892b0acc4d766eda9bb98085a6f

>   3rdparty/libprocess/src/tests/test_linkee.cpp 1f6cfafcb73fd41ef350b13e3ac6023d78f16f5a

> 
> Diff: https://reviews.apache.org/r/53460/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message