diff --git a/synchronize.c b/synchronize.c index 96785565..5b451f9c 100644 --- a/synchronize.c +++ b/synchronize.c @@ -168,6 +168,11 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData, char pRead[80]; int test,i; SConnection *internalCon = NULL; + int try; + + try = 2; +tryagain: + try--; /* check for connection @@ -201,9 +206,9 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData, NETClosePort(connection); free(connection); connection = NULL; - SCWrite(pCon,"ERROR: Failed to contact sync server",eError); - SCWrite(pCon,"Try again in order to reconnect before giving up",eWarning); ClearFixedStatus(eEager); + if (try > 0) goto tryagain; + SCWrite(pCon,"ERROR: Failed to contact main SICS server",eError); return 0; } /* @@ -222,11 +227,10 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData, NETClosePort(connection); free(connection); connection = NULL; - SCWrite(pCon,"ERROR: Failed to contact sync server",eError); - SCWrite(pCon, - "Try again in order to reconnect before giving up",eWarning); ClearFixedStatus(eEager); pServ->simMode = 1; + if (try > 0) goto tryagain; + SCWrite(pCon,"ERROR: Failed to contact main SICS server",eError); return 0; } else