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

2016-04-20 Thread Daniel Pravat


> On April 19, 2016, 10:31 p.m., Michael Park wrote:
> > 3rdparty/libprocess/src/poll_socket.cpp, lines 204-230
> > 
> >
> > 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: [2/3] `sendfile` used with the typed error state of `Try`.

2016-04-19 Thread Michael Park

---
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)


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



3rdparty/libprocess/src/poll_socket.cpp (lines 204 - 220)


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
> 
>