Browse Source

Use faster and more robust memchr for detecting EOL in read_socket_line

master
Con Kolivas 9 years ago
parent
commit
606f570c3d
  1. 4
      src/ckpool.c

4
src/ckpool.c

@ -654,7 +654,7 @@ int read_socket_line(connsock_t *cs, float *timeout)
clear_bufline(cs); clear_bufline(cs);
recv_available(ckp, cs); // Intentionally ignore return value recv_available(ckp, cs); // Intentionally ignore return value
eom = strchr(cs->buf, '\n'); eom = memchr(cs->buf, '\n', cs->bufofs);
tv_time(&start); tv_time(&start);
@ -692,7 +692,7 @@ int read_socket_line(connsock_t *cs, float *timeout)
ret = -1; ret = -1;
goto out; goto out;
} }
eom = strchr(cs->buf, '\n'); eom = memchr(cs->buf, '\n', cs->bufofs);
tv_time(&now); tv_time(&now);
diff = tvdiff(&now, &start); diff = tvdiff(&now, &start);
copy_tv(&start, &now); copy_tv(&start, &now);

Loading…
Cancel
Save