aboutsummaryrefslogtreecommitdiff
path: root/weechat
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-04-08 14:50:01 +0200
committertomsmeding <tom.smeding@gmail.com>2017-04-08 14:50:01 +0200
commit8b3c4f2ae25cb3a9a1483412b59548d94a6432e1 (patch)
tree768c0151926586cf436ea400cb5fae5b1dcfce66 /weechat
parent805a64bf2ce5a529fb0d8f53ca584b3d3d2e75a7 (diff)
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
Diffstat (limited to 'weechat')
-rw-r--r--weechat/tomsg.c5
1 files changed, 4 insertions, 1 deletions
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);