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

Move the retry loop from smb_addmsg() to smb_fread().

parent 45834797
No related branches found
No related tags found
No related merge requests found
......@@ -80,15 +80,7 @@ int SMBCALL smb_addmsg(smb_t* smb, smbmsg_t* msg, int storage, long dupechk_hash
/* try */
do {
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)
if((retval = smb_getstatus(smb)) != SMB_SUCCESS)
break;
msg->hdr.number=smb->status.last_msg+1;
......
......@@ -98,7 +98,7 @@ size_t SMBCALL smb_fread(smb_t* smb, void* buf, size_t bytes, FILE* fp)
while(1) {
if((ret=fread(buf,sizeof(char),bytes,fp))==bytes)
return(ret);
if(get_errno()!=EDEADLOCK)
if(get_errno()!=EDEADLOCK && get_errno()!=EACCES)
return(ret);
if(!start)
start=time(NULL);
......@@ -182,12 +182,7 @@ int SMBCALL smb_open_fp(smb_t* smb, FILE** fp, int share)
close(file);
return(SMB_ERR_OPEN);
}
#if 0 /* This causes a noticeable performance hit when new-scanning subs */
if(fp==&smb->sid_fp)
setvbuf(*fp,NULL,_IONBF,0); /* no buffering (cause of *.sid corruption?) */
else
#endif
setvbuf(*fp,NULL,_IOFBF,2*1024);
setvbuf(*fp,NULL,_IOFBF, 2*1024);
return(SMB_SUCCESS);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment