From 8b3c4f2ae25cb3a9a1483412b59548d94a6432e1 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sat, 8 Apr 2017 14:50:01 +0200 Subject: weechat: Also catch EAGAIN Apparently weechat sets O_NONBLOCK on a socket: https://github.com/weechat/weechat/blob/705d86e684d72b8c094e526876db1b8544fd2db3/src/core/wee-network.c#L1105 --- weechat/tomsg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'weechat') diff --git a/weechat/tomsg.c b/weechat/tomsg.c index c53a9a0..1235a71 100644 --- a/weechat/tomsg.c +++ b/weechat/tomsg.c @@ -218,7 +218,10 @@ static int fd_hook_callback(const void *conn_vp,void *_d,int fd){ while(true){ nr=recv(fd,conn->linebuf+conn->linebuf_len,conn->linebuf_sz-conn->linebuf_len,0); if(nr<=0){ - if(nr<0&&errno==EINTR)continue; + if(nr<0){ + if(errno==EINTR)continue; + if(errno==EAGAIN)return WEECHAT_RC_OK; // next time around maybe? + } fprintf(debugf,"fd_hook_callback: recv() <= 0: %s\n",strerror(errno)); weechat_printf(NULL,"tomsg: Connection dropped"); weechat_buffer_close(conn->buffer); -- cgit v1.2.3-70-g09d2