You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Daniel Pravat <dp...@outlook.com> on 2016/04/16 02:20:15 UTC

Review Request 46285: Windows: [2/3] `sendfile` used with the typed error state of `Try`.

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

Review request for mesos, Artem Harutyunyan, Alex Clemmer, Joris Van Remoortere, and Michael Park.


Repository: mesos


Description
-------

Windows: [2/3] `sendfile` used with the typed error state of `Try`.


Diffs
-----

  3rdparty/libprocess/src/poll_socket.cpp cb2878565a112017b190b4ff83dc65a876ea45f9 

Diff: https://reviews.apache.org/r/46285/diff/


Testing
-------

OSX: make check


Thanks,

Daniel Pravat


Re: Review Request 46285: Windows: [2/3] `sendfile` used with the typed error state of `Try`.

Posted by Daniel Pravat <dp...@outlook.com>.

> On April 19, 2016, 10:31 p.m., Michael Park wrote:
> > 3rdparty/libprocess/src/poll_socket.cpp, lines 204-230
> > <https://reviews.apache.org/r/46285/diff/1/?file=1347495#file1347495line204>
> >
> >     How about we clean this up a little bit:
> >     
> >     ```cpp
> >     if (!length.isError()) {
> >       CHECK(length.get() >= 0);
> >       if (length.get() == 0) {
> >         // Socket closed.
> >         VLOG(1) << "Socket closed while sending";
> >       }
> >       return length.get();
> >     }
> >     
> >     if (net::is_restartable_error(length.error().code)) {
> >       // Interrupted, try again now.
> >       continue;
> >     } else if (net::is_retryable_error(length.error().code)) {
> >       // Might block, try again later.
> >       return io::poll(s, io::WRITE)
> >         .then(lambda::bind(&internal::socket_send_file, s, fd, offset, size));
> >     } else {
> >       // Socket error.
> >       VLOG(1) << length.error().message;
> >       return Failure(length.error());
> >     }
> >     ```

Are we sure this test & error is correct ? 
if (length.get() == 0) {
    // Socket closed.
    VLOG(1) << "Socket closed while sending";
}


- Daniel


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


On April 16, 2016, 12:20 a.m., Daniel Pravat wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46285/
> -----------------------------------------------------------
> 
> (Updated April 16, 2016, 12:20 a.m.)
> 
> 
> Review request for mesos, Artem Harutyunyan, Alex Clemmer, Joris Van Remoortere, and Michael Park.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Windows: [2/3] `sendfile` used with the typed error state of `Try`.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/poll_socket.cpp cb2878565a112017b190b4ff83dc65a876ea45f9 
> 
> Diff: https://reviews.apache.org/r/46285/diff/
> 
> 
> Testing
> -------
> 
> OSX: make check
> 
> 
> Thanks,
> 
> Daniel Pravat
> 
>


Re: Review Request 46285: Windows: [3/4] `sendfile` used with the typed error state of `Try`.

Posted by Michael Park <mp...@apache.org>.

> On April 19, 2016, 10:31 p.m., Michael Park wrote:
> > 3rdparty/libprocess/src/poll_socket.cpp, lines 204-230
> > <https://reviews.apache.org/r/46285/diff/1/?file=1347495#file1347495line204>
> >
> >     How about we clean this up a little bit:
> >     
> >     ```cpp
> >     if (!length.isError()) {
> >       CHECK(length.get() >= 0);
> >       if (length.get() == 0) {
> >         // Socket closed.
> >         VLOG(1) << "Socket closed while sending";
> >       }
> >       return length.get();
> >     }
> >     
> >     if (net::is_restartable_error(length.error().code)) {
> >       // Interrupted, try again now.
> >       continue;
> >     } else if (net::is_retryable_error(length.error().code)) {
> >       // Might block, try again later.
> >       return io::poll(s, io::WRITE)
> >         .then(lambda::bind(&internal::socket_send_file, s, fd, offset, size));
> >     } else {
> >       // Socket error.
> >       VLOG(1) << length.error().message;
> >       return Failure(length.error());
> >     }
> >     ```
> 
> Daniel Pravat wrote:
>     Are we sure this test & error is correct ? 
>     if (length.get() == 0) {
>         // Socket closed.
>         VLOG(1) << "Socket closed while sending";
>     }

I haven't dug into it, but it is the existing behavior. Is it incorrect?


- Michael


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


On April 20, 2016, 4:44 p.m., Daniel Pravat wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46285/
> -----------------------------------------------------------
> 
> (Updated April 20, 2016, 4:44 p.m.)
> 
> 
> Review request for mesos, Artem Harutyunyan, Alex Clemmer, Joris Van Remoortere, and Michael Park.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Windows: [3/4] `sendfile` used with the typed error state of `Try`.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/poll_socket.cpp cb2878565a112017b190b4ff83dc65a876ea45f9 
> 
> Diff: https://reviews.apache.org/r/46285/diff/
> 
> 
> Testing
> -------
> 
> OSX: make check
> 
> 
> Thanks,
> 
> Daniel Pravat
> 
>


Re: Review Request 46285: Windows: [2/3] `sendfile` used with the typed error state of `Try`.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46285/#review129635
-----------------------------------------------------------




3rdparty/libprocess/src/poll_socket.cpp (line 135)
<https://reviews.apache.org/r/46285/#comment193104>

    This is already part of master. It looks like this patch needs to be rebased.



3rdparty/libprocess/src/poll_socket.cpp (lines 204 - 220)
<https://reviews.apache.org/r/46285/#comment193105>

    How about we clean this up a little bit:
    
    ```cpp
    if (!length.isError()) {
      CHECK(length.get() >= 0);
      if (length.get() == 0) {
        // Socket closed.
        VLOG(1) << "Socket closed while sending";
      }
      return length.get();
    }
    
    if (net::is_restartable_error(length.error().code)) {
      // Interrupted, try again now.
      continue;
    } else if (net::is_retryable_error(length.error().code)) {
      // Might block, try again later.
      return io::poll(s, io::WRITE)
        .then(lambda::bind(&internal::socket_send_file, s, fd, offset, size));
    } else {
      // Socket error.
      VLOG(1) << length.error().message;
      return Failure(length.error());
    }
    ```


- Michael Park


On April 16, 2016, 12:20 a.m., Daniel Pravat wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46285/
> -----------------------------------------------------------
> 
> (Updated April 16, 2016, 12:20 a.m.)
> 
> 
> Review request for mesos, Artem Harutyunyan, Alex Clemmer, Joris Van Remoortere, and Michael Park.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Windows: [2/3] `sendfile` used with the typed error state of `Try`.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/poll_socket.cpp cb2878565a112017b190b4ff83dc65a876ea45f9 
> 
> Diff: https://reviews.apache.org/r/46285/diff/
> 
> 
> Testing
> -------
> 
> OSX: make check
> 
> 
> Thanks,
> 
> Daniel Pravat
> 
>


Re: Review Request 46285: Windows: [3/4] `sendfile` used with the typed error state of `Try`.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46285/#review130040
-----------------------------------------------------------


Ship it!




Committed with the following change.


3rdparty/libprocess/src/poll_socket.cpp (line 223)
<https://reviews.apache.org/r/46285/#comment193653>

    `s/Failure(length.error());/return Failure(length.error());/`


- Michael Park


On April 20, 2016, 4:44 p.m., Daniel Pravat wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46285/
> -----------------------------------------------------------
> 
> (Updated April 20, 2016, 4:44 p.m.)
> 
> 
> Review request for mesos, Artem Harutyunyan, Alex Clemmer, Joris Van Remoortere, and Michael Park.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Windows: [3/4] `sendfile` used with the typed error state of `Try`.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/poll_socket.cpp cb2878565a112017b190b4ff83dc65a876ea45f9 
> 
> Diff: https://reviews.apache.org/r/46285/diff/
> 
> 
> Testing
> -------
> 
> OSX: make check
> 
> 
> Thanks,
> 
> Daniel Pravat
> 
>


Re: Review Request 46285: Windows: [3/4] `sendfile` used with the typed error state of `Try`.

Posted by Daniel Pravat <dp...@outlook.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46285/
-----------------------------------------------------------

(Updated April 20, 2016, 4:44 p.m.)


Review request for mesos, Artem Harutyunyan, Alex Clemmer, Joris Van Remoortere, and Michael Park.


Summary (updated)
-----------------

Windows: [3/4] `sendfile` used with the typed error state of `Try`.


Repository: mesos


Description (updated)
-------

Windows: [3/4] `sendfile` used with the typed error state of `Try`.


Diffs (updated)
-----

  3rdparty/libprocess/src/poll_socket.cpp cb2878565a112017b190b4ff83dc65a876ea45f9 

Diff: https://reviews.apache.org/r/46285/diff/


Testing
-------

OSX: make check


Thanks,

Daniel Pravat