[simias-svn] SF.net SVN: simias:[7436] trunk/src/core/Sync
Brought to you by:
srinidhi_bs
|
From: <he...@us...> - 2010-07-21 14:13:28
|
Revision: 7436
http://simias.svn.sourceforge.net/simias/?rev=7436&view=rev
Author: hegdegg
Date: 2010-07-21 14:13:22 +0000 (Wed, 21 Jul 2010)
Log Message:
-----------
Fix for not able to uplaod single 2+ gb rar file that is modified. Also
fixes 500 internal error for some issue.
Modified Paths:
--------------
trunk/src/core/Sync/ClientFile.cs
trunk/src/core/Sync/Http.cs
trunk/src/core/Sync/StreamStream.cs
trunk/src/core/Sync/SyncFile.cs
trunk/src/core/Sync/SyncService.cs
Modified: trunk/src/core/Sync/ClientFile.cs
===================================================================
--- trunk/src/core/Sync/ClientFile.cs 2010-07-21 11:26:46 UTC (rev 7435)
+++ trunk/src/core/Sync/ClientFile.cs 2010-07-21 14:13:22 UTC (rev 7436)
@@ -1205,8 +1205,7 @@
clientBlockCount = (int)Length/blockSize+1;
else
clientBlockCount = (int)Length/blockSize;
- Log.log.Debug("client block count ={0}", clientBlockCount);
- Log.log.Debug("server block count ={0}", serverBlockCount);
+ Log.log.Debug("file length = {0}, blockSize = {1}, client block count = {2}, server block count = {3}", Length, blockSize, clientBlockCount, serverBlockCount);
}
/// No data to sync, file is available in server, not renamed and block count matches
Modified: trunk/src/core/Sync/Http.cs
===================================================================
--- trunk/src/core/Sync/Http.cs 2010-07-21 11:26:46 UTC (rev 7435)
+++ trunk/src/core/Sync/Http.cs 2010-07-21 14:13:22 UTC (rev 7436)
@@ -1309,13 +1309,15 @@
return;
}
- int count = int.Parse(sCount);
+ int loop = int.Parse(sCount);
int blockSize = int.Parse(sBlockSize);
+ long count = 0;
BinaryReader reader = new BinaryReader(request.InputStream);
- for (int i = 0; i < count; ++i)
+ for (int i = 0; i < loop; ++i)
{
BlockSegment bSeg = new BlockSegment(reader);
- service.Copy(bSeg.StartBlock * blockSize, bSeg.Offset, blockSize * (bSeg.EndBlock - bSeg.StartBlock + 1));
+ count = (long)(blockSize * (bSeg.EndBlock - bSeg.StartBlock + 1));
+ service.Copy(bSeg.StartBlock * blockSize, bSeg.Offset, count);
}
}
Modified: trunk/src/core/Sync/StreamStream.cs
===================================================================
--- trunk/src/core/Sync/StreamStream.cs 2010-07-21 11:26:46 UTC (rev 7435)
+++ trunk/src/core/Sync/StreamStream.cs 2010-07-21 14:13:22 UTC (rev 7436)
@@ -336,13 +336,13 @@
/// </summary>
/// <param name="inStream">The data to write.</param>
/// <param name="count">The number of bytes to write.</param>
- public void Write(Stream inStream, int count)
+ public void Write(Stream inStream, long count)
{
- int bytesLeft = count;
+ long bytesLeft = count;
while(bytesLeft > 0)
{
byte[] buffer = GetBuffer();
- int bytesRead = inStream.Read(buffer, 0, Math.Min(buffer.Length, bytesLeft));
+ int bytesRead = inStream.Read(buffer, 0, (int)Math.Min(buffer.Length, bytesLeft));
if (bytesRead != 0)
{
writeComplete.WaitOne();
Modified: trunk/src/core/Sync/SyncFile.cs
===================================================================
--- trunk/src/core/Sync/SyncFile.cs 2010-07-21 11:26:46 UTC (rev 7435)
+++ trunk/src/core/Sync/SyncFile.cs 2010-07-21 14:13:22 UTC (rev 7436)
@@ -357,12 +357,12 @@
/// <param name="originalOffset">The offset in the original file to copy from.</param>
/// <param name="offset">The offset in the file where the data is to be written.</param>
/// <param name="count">The number of bytes to write.</param>
- public void Copy(long originalOffset, long offset, int count)
+ public void Copy(long originalOffset, long offset, long count)
{
lock (this)
{
- ReadPosition = originalOffset;
- WritePosition = offset;
+ ReadPosition = Math.Abs(originalOffset);
+ WritePosition = Math.Abs(offset);
workStream.Write(stream, count);
}
}
Modified: trunk/src/core/Sync/SyncService.cs
===================================================================
--- trunk/src/core/Sync/SyncService.cs 2010-07-21 11:26:46 UTC (rev 7435)
+++ trunk/src/core/Sync/SyncService.cs 2010-07-21 14:13:22 UTC (rev 7436)
@@ -1227,7 +1227,7 @@
/// <param name="oldOffset">The offset in the old (original file).</param>
/// <param name="offset">The offset in the new file.</param>
/// <param name="count">The number of bytes to copy.</param>
- public void Copy(long oldOffset, long offset, int count)
+ public void Copy(long oldOffset, long offset, long count)
{
inFile.Copy(oldOffset, offset, count);
logger.LogAccessDebug("CopyFile", inFile.Name, collection.ID, "Success");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|