major rework logic used for detection of corrupted upload sessions
This commit is contained in:
parent
d981767170
commit
c48b2d488f
|
|
@ -10,6 +10,15 @@ Version NEXT
|
|||
glob() function used in FSP clients renamed to bsdglob because it
|
||||
clashed with glob() functin in newer Linux glibc resulting in
|
||||
segfaults.
|
||||
non continuous upload detection fixed. Now detection works as follows:
|
||||
if you are trying to upload past end of file, fspd will report that
|
||||
you are trying to create hole in file.
|
||||
if you are seeking backwards more than 1 packet size fspd will
|
||||
report noncontinuous upload. Most likely port from old unfinished
|
||||
download was reused.
|
||||
We can now reupload last block which can happen if fspd server is
|
||||
restarted and reply to upload command is lost on way from server
|
||||
to client.
|
||||
|
||||
Version 2.8.1b25 - 10 Sep 2009
|
||||
GNU autotools build system was entirely replaced by SCons
|
||||
|
|
|
|||
|
|
@ -823,7 +823,13 @@ const char *server_up_load (char * data, unsigned int len, unsigned long pos,
|
|||
some data loss due to libc stdio write caching */
|
||||
/* server do not cleans temporary directory on startup - so
|
||||
uploads across restart should work */
|
||||
if(pos > sf.st_size || pos < sf.st_size - UBUF_SPACE)
|
||||
if(pos > sf.st_size)
|
||||
{
|
||||
fclose(fp);
|
||||
unlink(tname);
|
||||
return("You are creating hole in file. Restart upload.");
|
||||
}
|
||||
if(pos + len < sf.st_size)
|
||||
{
|
||||
fclose(fp);
|
||||
unlink(tname);
|
||||
|
|
@ -851,21 +857,25 @@ const char *server_up_load (char * data, unsigned int len, unsigned long pos,
|
|||
|
||||
/* check for uploading on non-tail of file */
|
||||
sf.st_size= ftello(fp);
|
||||
if(pos > sf.st_size || pos < sf.st_size - UBUF_SPACE)
|
||||
if(pos > sf.st_size)
|
||||
{
|
||||
f_cache_delete_entry(fpcache,cache_f);
|
||||
unlink(tname);
|
||||
if( pos == 0)
|
||||
{
|
||||
/* we can retry */
|
||||
return server_up_load (data,len,pos,inet_num,port_num);
|
||||
return("You are creating hole in file. Restart upload.");
|
||||
}
|
||||
if(pos + len < sf.st_size)
|
||||
{
|
||||
f_cache_delete_entry(fpcache,cache_f);
|
||||
unlink(tname);
|
||||
return("Non continuous upload detected. Restart upload please.");
|
||||
}
|
||||
/*
|
||||
if(fseeko(fp, pos, SEEK_SET))
|
||||
if ( pos != sf.st_size )
|
||||
{
|
||||
if(fseeko(fp, pos, SEEK_SET)) {
|
||||
f_cache_delete_entry(fpcache,cache_f);
|
||||
return("Seeking in file failed");
|
||||
*/
|
||||
}
|
||||
}
|
||||
if(len!=fwrite(data, 1, len, fp))
|
||||
{
|
||||
f_cache_delete_entry(fpcache,cache_f);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user