I was writing a tcp client which reads from a socket and somehow the libuv
`on_tcp_read_cb` was getting called with nread = -1 and the program was
terminating with segmentation fault immediately after processing this
incoming error/eof; which I could somewhat fix using the different
signature of `on_alloc_cb`

    extern fn on_alloc_cb(&out_buf: uv::ll::uv_buf_t, handle:
*libc::c_void, suggested_size: libc::size_t) -> uv::ll::uv_buf_t unsafe

as opposed to the library signature

    extern fn on_alloc_cb(handle: *libc::c_void, suggested_size:
libc::size_t) -> uv::ll::uv_buf_t unsafe

The client has nread > 0 and I am able to read the data but the program
segfaults shortly after that step.

What am I doing wrong? Has anyone faced a similar issue. What sort of
debugging information can I provide?
Thanks for your help :)

Attachment: client.rs
Description: Binary data

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to