Add 5 seconds read timeout to RSocket.http_get()

This commit is contained in:
pancake 2015-03-03 00:45:13 +01:00
parent 1ee9f99b3b
commit 2ebab53fc5

View File

@ -8,6 +8,7 @@ static char *r_socket_http_answer (RSocket *s, int *code, int *rlen) {
int ret, olen, len = 0, bufsz = 32768, delta = 0;
char *dn, *res, *buf = malloc (bufsz); // XXX: use r_buffer here
r_socket_block_time (s, 1, 5);
res = NULL;
olen = r_socket_read_block (s, (unsigned char*) buf, bufsz);
if (olen < 1) goto fail;