cserve2: Handle interrupts when failing to read from server

If we don't do that, the client will end up in an infinite loop
from where it just can't exit, if the server is dead/stuck.
This commit is contained in:
Jean-Philippe Andre 2013-06-20 14:11:32 +09:00 committed by Cedric Bail
parent 1821c91d10
commit 4b473c90c0
1 changed files with 12 additions and 2 deletions

View File

@ -360,6 +360,11 @@ _server_dispatch_until(unsigned int rid)
* Or maybe just return EINA_FALSE after some timeout?
* -- jpeg
*/
if (errno == EINTR)
{
DBG("giving up on request %d after interrupt", rid);
return EINA_FALSE;
}
}
}
}
@ -638,7 +643,7 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key, Evas
return msg_open.base.rid;
}
unsigned int
static unsigned int
_image_setopts_server_send(Image_Entry *ie)
{
File_Entry *fentry;
@ -651,6 +656,8 @@ _image_setopts_server_send(Image_Entry *ie)
fentry = ie->data1;
dentry = calloc(1, sizeof(*dentry));
if (!dentry)
return 0;
memset(&msg, 0, sizeof(msg));
dentry->image_id = ++_data_id;
@ -681,7 +688,10 @@ _image_setopts_server_send(Image_Entry *ie)
msg.opts.orientation = ie->load_opts.orientation;
if (!_server_send(&msg, sizeof(msg), NULL, NULL))
return 0;
{
free(dentry);
return 0;
}
ie->data2 = dentry;