Commit ca60b3c0 authored by rswindell's avatar rswindell

Do not lock node.dab record before reading, this causes a record to become

permanently locked under some circumstances on Win32.
parent 6eff22bc
......@@ -163,12 +163,15 @@ void __fastcall TNodeForm::TimerTick(TObject *Sender)
lseek(nodedab, n*sizeof(node_t), SEEK_SET);
if(eof(nodedab))
break;
#ifdef USE_LOCKING
if(locking(nodedab, LK_NBLCK, sizeof(node_t))!=0)
continue;
#endif
rd=read(nodedab,&node, sizeof(node_t));
lseek(nodedab, n*sizeof(node_t), SEEK_SET);
#ifdef USE_LOCKING
locking(nodedab, LK_UNLCK, sizeof(node_t));
#endif
if(rd!=sizeof(node_t))
continue;
......
......@@ -70,9 +70,9 @@ int sbbs_t::getnodedat(uint number, node_t *node, bool lockit)
for(count=0;count<LOOP_NODEDAB;count++) {
if(count)
mswait(100);
if(lock(nodefile,(long)number*sizeof(node_t),sizeof(node_t))!=0) {
if(lockit && lock(nodefile,(long)number*sizeof(node_t),sizeof(node_t))!=0) {
unlock(nodefile,(long)number*sizeof(node_t),sizeof(node_t));
continue;
continue;
}
lseek(nodefile,(long)number*sizeof(node_t),SEEK_SET);
rd=read(nodefile,node,sizeof(node_t));
......
......@@ -689,8 +689,8 @@ int DLLCALL getnodedat(scfg_t* cfg, uint number, node_t *node, int* fdp)
if(count)
mswait(100);
lseek(file,(long)number*sizeof(node_t),SEEK_SET);
if(lock(file,(long)number*sizeof(node_t),sizeof(node_t))!=0
&& fdp!=NULL)
if(fdp!=NULL
&& lock(file,(long)number*sizeof(node_t),sizeof(node_t))!=0)
continue;
rd=read(file,node,sizeof(node_t));
if(fdp==NULL || rd!=sizeof(node_t))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment