From 6e926d7be7901b1b9c6456a135728b9a929186df Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 29 Apr 1999 03:35:16 +0000 Subject: Cleaner retry logic. svn path=/trunk/; revision=2458 --- driver.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 1172ca30..403bde10 100644 --- a/driver.c +++ b/driver.c @@ -2197,15 +2197,20 @@ const struct method *proto; /* protocol method table */ break; if (ok != PS_LOCKBUSY) lockouts = 0; - - /* - * Allow time for the server lock to release. if we don't - * do this, we'll often hit a locked-mailbox condition and fail. - */ - sleep(3); + else if (lockouts >= MAX_LOCKOUTS) + break; + else /* ok == PS_LOCKBUSY */ + { + /* + * Allow time for the server lock to release. if we + * don't do this, we'll often hit a locked-mailbox + * condition and fail. + */ + lockouts++; + sleep(3); + } } while - (ok == PS_MAXFETCH - || (ok == PS_LOCKBUSY && lockouts++ < MAX_LOCKOUTS)); + (ok == PS_MAXFETCH || ok == PS_LOCKBUSY); return(ok); } -- cgit v1.2.3