Don't recurse into datalink_UpdateSet() after

doing a HangupDone().  The HangupDone() may fuel
bundle_CleanDatalinks(), and if so, the bogus
UpdateSet() ends up select()ing on a closed
descriptor.....

Change the main `do/while' loop to a `for' loop so
that any `continue's do the bundle_CleanDatalinks()
& bundle_IsDead() bit.
This commit is contained in:
Brian Somers 1999-11-09 23:21:47 +00:00
parent 647fc635a3
commit da8b70349b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53070
2 changed files with 6 additions and 4 deletions

View File

@ -332,9 +332,11 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
if (dl->script.run) {
datalink_NewState(dl, DATALINK_HANGUP);
chat_Init(&dl->chat, dl->physical, dl->cfg.script.hangup, NULL);
} else
return datalink_UpdateSet(d, r, w, e, n);
} else {
datalink_HangupDone(dl);
return datalink_UpdateSet(d, r, w, e, n);
return 0; /* Maybe bundle_CleanDatalinks() has something to do */
}
}
case DATALINK_HANGUP:

View File

@ -506,7 +506,7 @@ DoLoop(struct bundle *bundle)
probe_Init(&probe);
do {
for (; !bundle_IsDead(bundle); bundle_CleanDatalinks(bundle)) {
nfds = 0;
FD_ZERO(&rfds);
FD_ZERO(&wfds);
@ -619,7 +619,7 @@ DoLoop(struct bundle *bundle)
t.tv_usec = 100000;
select(0, NULL, NULL, NULL, &t);
}
} while (bundle_CleanDatalinks(bundle), !bundle_IsDead(bundle));
}
log_Printf(LogDEBUG, "DoLoop done.\n");
}