Skip to content
Snippets Groups Projects
Commit 27adb21b authored by Rob Swindell's avatar Rob Swindell :speech_balloon: Committed by Deucе
Browse files

Insure FILE_RETRY_DELAY before lock retries

parent 6a66938b
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,8 @@ bool sbbs_t::getnodedat(uint number, node_t *node, bool lockit)
utime(str,NULL); /* NFS fix... utime() forces a cache refresh */
#endif
for(count=0;count<LOOP_NODEDAB;count++) {
if(count > 0)
FILE_RETRY_DELAY(count + 1);
if(lockit && lock(nodefile, nodedatoffset(number), sizeof(node_t))!=0) {
unlock(nodefile, nodedatoffset(number), sizeof(node_t));
continue;
......@@ -67,7 +69,6 @@ bool sbbs_t::getnodedat(uint number, node_t *node, bool lockit)
if(rd==sizeof(node_t))
break;
}
FILE_RETRY_DELAY(count + 1);
}
if(!lockit && cfg.node_misc&NM_CLOSENODEDAB) {
close(nodefile);
......@@ -289,6 +290,8 @@ bool sbbs_t::getnodeext(uint number, char *ext)
number--; /* make zero based */
for(count=0;count<LOOP_NODEDAB;count++) {
if(count > 0)
FILE_RETRY_DELAY(count + 1);
if(lock(node_ext,(long)number*128L,128)!=0)
continue;
lseek(node_ext,(long)number*128L,SEEK_SET);
......@@ -296,7 +299,6 @@ bool sbbs_t::getnodeext(uint number, char *ext)
unlock(node_ext,(long)number*128L,128);
if(rd==128)
break;
FILE_RETRY_DELAY(count + 1);
}
close(node_ext);
node_ext=-1;
......
......@@ -118,12 +118,12 @@ bool sbbs_t::putnodeext(uint number, char *ext)
}
for(count=0;count<LOOP_NODEDAB;count++) {
lseek(node_ext,(long)number*128L,SEEK_SET);
if(lock(node_ext,(long)number*128L,128)==-1)
continue;
wr=write(node_ext,ext,128);
unlock(node_ext,(long)number*128L,128);
if(wr==128)
break;
if(lock(node_ext,(long)number*128L,128) == 0) {
wr=write(node_ext,ext,128);
unlock(node_ext,(long)number*128L,128);
if(wr==128)
break;
}
FILE_RETRY_DELAY(count + 1);
}
close(node_ext);
......@@ -132,7 +132,7 @@ bool sbbs_t::putnodeext(uint number, char *ext)
if(count>(LOOP_NODEDAB/2) && count!=LOOP_NODEDAB) {
snprintf(str, sizeof str, "NODE.EXB (node %d) COLLISION - Count: %d"
,number+1, count);
logline(LOG_NOTICE,"!!",str);
logline(LOG_NOTICE,"!!",str);
}
if(count==LOOP_NODEDAB) {
errormsg(WHERE,ERR_WRITE,"NODE.EXB",number+1);
......
......@@ -1149,6 +1149,8 @@ int getnodedat(scfg_t* cfg, uint number, node_t *node, bool lockit, int* fdp)
int result = USER_SIZE_ERROR;
if(filelength(file)>=(long)(number*sizeof(node_t))) {
for(count=0;count<LOOP_NODEDAB;count++) {
if(count > 0)
FILE_RETRY_DELAY(count + 1);
if(!seeknodedat(file, number)) {
result = USER_SEEK_ERROR;
continue;
......@@ -1166,7 +1168,6 @@ int getnodedat(scfg_t* cfg, uint number, node_t *node, bool lockit, int* fdp)
result = USER_SUCCESS;
break;
}
FILE_RETRY_DELAY(count + 1);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment