Skip to content
Snippets Groups Projects
Commit 73fb994a authored by rswindell's avatar rswindell
Browse files

If smb_getstatus() fails with a SMB_ERR_READ (-203) error while trying to add

a new message with smb_addmsg(), retry (using the configured delay/timeout
values).
On Windows, importing a QWK packet into SMB messagebases stored on a remote
Samba server, for some unknown reason, the read of the msgbase status header
here would fail about 1 out of 100 times, with the error:
 evnt ERROR 13 (Permission denied) (WinError 33) in qwktomsg.cpp line 515
 (sbbs_t::qwk_import_msg) writing "msgbase" access=-203 info=smb_getstatus
 reading status
... as if another task had the msgbase status hdr locked (which, they don't),
and we (this thread) already had it locked (just 8 lines up in this same
function), so shouldn't even be possible. A single retry appeared to be
sufficient, but I went ahead and put the timed-loop with the delay in here.
parent 8caa2fcb
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ int SMBCALL smb_addmsg(smb_t* smb, smbmsg_t* msg, int storage, long dupechk_hash
hash_t found;
hash_t** hashes=NULL; /* This is a NULL-terminated list of hashes */
smbmsg_t remsg;
time_t start = 0;
if(!SMB_IS_OPEN(smb)) {
safe_snprintf(smb->last_error,sizeof(smb->last_error),"%s msgbase not open", __FUNCTION__);
......@@ -79,7 +80,15 @@ int SMBCALL smb_addmsg(smb_t* smb, smbmsg_t* msg, int storage, long dupechk_hash
/* try */
do {
if((retval=smb_getstatus(smb))!=SMB_SUCCESS)
while((retval=smb_getstatus(smb)) == SMB_ERR_READ) {
if(!start)
start=time(NULL);
else
if(time(NULL)-start>=(time_t)smb->retry_time)
break;
SLEEP(smb->retry_delay);
}
if(retval != SMB_SUCCESS)
break;
msg->hdr.number=smb->status.last_msg+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