Hi

I've run into an issue and I'm wondering if it's expected behavior or not.

If a bufferevent with a configured read-high-watermark actually reaches the 
watermark, the TCP disconnect on the underlying socket is not reported.  I've 
observed this on Mac OS X (kevent) as well as linux 3.5 (epoll), using libevent 
2.0.21

Here's a simple example.  Error checking omitted for brevity:  
https://gist.github.com/minaguib/5250939

To reproduce, compile and run the server, which will listen on port 5001.

Do a simple test which does not exceed the read high watermark:
        $ echo "1" | nc localhost 5001
The server prints:
        New client
        Got data from client - ignoring it
        Client disconnected

Next, do a simple test which exceeds the read high watermark:
        $ echo "hello world" | nc localhost 5001
The server prints:
        New client
        Got data from client - ignoring it

Note that even though netcat has died, and the client->server FIN packet has 
been sent and ACKnowledged (verified with tcpdump), the 
handle_client_buffer_evt callback was never invoked.

Is it a requirement that input is fully drained so that libevent can observe 
the underlying socket's closure ?  Perhaps I've wrongly assumed that 
event/error notifications are out-of-band when they're not.

FWIW this is what I see with strace on linux when I write "hello world" from 
the client then the client closes:

        {{EPOLLIN, {u32=8, u64=8}}}, 32, -1) = 1
        ioctl(8, FIONREAD, [13])                = 0
        readv(8, [{"hell", 4}], 1)              = 4
        epoll_ctl(3, EPOLL_CTL_DEL, 8, {EPOLLIN, {u32=8, u64=8}}) = 0
        write(1, "Got data from client - ignoring "..., 35Got data from client 
- ignoring it
        ) = 35
        epoll_wait(3,







***********************************************************************
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-users    in the body.

Reply via email to