Pull from CVS head: * Always call ms_sleep after we call do_send so that we give the
radius server a chance to breath a little.
int skip;
long fpos;
int x;
+ unsigned int i = 0;
/* Never happens */
if (r_req->state == STATE_FULL)
fpos = ftell(fp);
fseek(fp, 0L, SEEK_SET);
do {
- x = rad_lockfd(fileno(fp), 0);
+ x = rad_lockfd_nonblock(fileno(fp), 0);
if (x == -1)
ms_sleep(25);
- } while (x == -1);
+ } while (x == -1 && i++ < 80);
+
+ if (x == -1)
+ return 0;
s = NULL;
fseek(fp, fpos, SEEK_SET);
for (i = 0; i < NR_SLOTS; i++) {
if (slots[i].state == STATE_FULL) {
n += do_send(&slots[i], r_args->secret);
- if (n > 1) ms_sleep(140);
+ ms_sleep(140);
if (n > NR_SLOTS / 2)
break;
}