Open ibc opened 12 years ago
NOTE: Check the same in UDP !
More stuf about TCP for receiving and disconnection:
[18:18:41]hi, easy question (I think there must be some bug in my code): [18:19:42] outbound TCP connection done and I call uv_close(handle), should the read cb be called with nread==-1 or not? [18:23:26] note: in my question I did start_read() [18:23:48] ibc: no. [18:23:55] ibc: uv_close will implicitly call read_stop [18:24:06] ibc: but in theory it may make the read callback once more with nread==0 [18:24:22] which might happen if it already called alloc_cb and wants you to give the buffer bacl [18:24:31] "it may" does not seem a very robust mechanism :) [18:24:40] aha, I understand [18:25:15] so if I call uv_close() in a connected socket, then I should call my "on_disconnection" callback by myself, am I right? [18:25:43] ibc: ehm... yes, if that's what you want to do :-) [18:25:53] clear, thanks a lot [18:26:07] ibc: normally you'll get -1/UV_EOF only if the remote gracefully closed the connection [19:11:02] hi, can I be sure that if I call uv_close() for a established connection, I won't be called to read cb with nread==-1 ? [19:11:43] I do know that it should not occur, I just want to be sure that it will never happen [19:14:42] ibc: should not happen.
Consider this also (found in a UV test unit):
if (req->handle->write_queue_size >= size * 2) { break; }
From the IRC: