Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tcpv{4,6}_socket: transform EPIPE into Eof #183

Merged
merged 1 commit into from
Mar 19, 2016
Merged

Commits on Feb 25, 2016

  1. Tcpv{4,6}_socket: transform EPIPE into Eof

    The V1.mli describes the result of `FLOW.write`:
    
    > The result [`Ok ()] indicates success, [`Eof] indicates
    > that the connection is now closed and [`Error]
    > indicates some other error.
    
    In Unix if a peer closes its socket then `write` will fail with
    `Unix_error(Unix.EPIPE, _, _)`, not a return value of 0 (unlike
    `read`). Before this patch if a peer closes its connection then
    the failure bubbles up to the consumer of the `FLOW` interface
    who knows nothing about Unix and will typically fail outright
    with an error like:
    
    ```
    Fatal error: exception Unix.Unix_error(Unix.EPIPE, "write", "")
    Raised by primitive operation at file "src/unix/lwt_bytes.ml", line 144, characters 43-86
    Called from file "src/unix/lwt_unix.ml", line 549, characters 17-28
    ```
    
    After this patch the consumer of the `FLOW` interface will
    receive an `Eof` indicating that the connection is now closed.
    
    Signed-off-by: David Scott <dave.scott@docker.com>
    djs55 committed Feb 25, 2016
    Configuration menu
    Copy the full SHA
    002812c View commit details
    Browse the repository at this point in the history