Hi ...
Please check this patch which helps here to fix the large file issue.
Greets
Jan-Simon
Index: src/core/Sync/StreamStream.cs
===================================================================
--- src/core/Sync/StreamStream.cs (Revision 6862)
+++ src/core/Sync/StreamStream.cs (Arbeitskopie)
@@ -39,8 +39,9 @@
static Queue Buffer = Queue.Synchronized(new Queue(2));
static int buffSize = 1024 * 64;
AutoResetEvent writeComplete = new AutoResetEvent(true);
- Exception exception;
-
+ AutoResetEvent allComplete = new AutoResetEvent(true);
+ Exception exception;
+
private static readonly ISimiasLog log = SimiasLogManager.GetLogger(typeof(StreamStream));
@@ -203,6 +204,12 @@
/// <returns>The number of bytes read.</returns>
public int Read(Stream outStream, int count)
{
+ AutoResetEvent[] eventArray = new AutoResetEvent[2];
+ eventArray[0] = allComplete;
+ eventArray[1] = writeComplete;
+ WaitHandle.WaitAll(eventArray);
+ writeComplete.Set();
+
wStream = outStream;
int bytesLeft = count;
while(bytesLeft > 0)
@@ -221,6 +228,7 @@
}
writeComplete.WaitOne();
writeComplete.Set();
+ allComplete.Set();
wStream = null;
return count - bytesLeft;
}
@@ -234,7 +242,13 @@
/// <returns>The number of bytes read.</returns>
public int Read(Stream outStream, int count, string encryptionAlgorithm, string EncryptionKey)
{
- wStream = outStream;
+ AutoResetEvent[] eventArray = new AutoResetEvent[2];
+ eventArray[0] = allComplete;
+ eventArray[1] = writeComplete;
+ WaitHandle.WaitAll(eventArray);
+ writeComplete.Set();
+
+ wStream = outStream;
int paddingLength = 0, reminder = 0;
int bytesLeft = count;
@@ -275,9 +289,10 @@
}
else break;
}
- writeComplete.WaitOne();
- writeComplete.Set();
- wStream = null;
+ writeComplete.WaitOne();
+ writeComplete.Set();
+ allComplete.Set();
+ wStream = null;
return count - bytesLeft + paddingLength;
}
@@ -312,7 +327,14 @@
/// <param name="count">The number of bytes to write.</param>
public void Write(Stream inStream, int count)
{
- int bytesLeft = count;
+ AutoResetEvent[] eventArray = new AutoResetEvent[2];
+ eventArray[0] = allComplete;
+ eventArray[1] = writeComplete;
+ WaitHandle.WaitAll(eventArray);
+ writeComplete.Set();
+
+
+ int bytesLeft = count;
while(bytesLeft > 0)
{
byte[] buffer = GetBuffer();
@@ -329,6 +351,7 @@
}
writeComplete.WaitOne();
writeComplete.Set();
+ allComplete.Set();
}
/// <summary>
@@ -339,7 +362,13 @@
/// <param name="encryption_key">Key to encrypt the data with.</param>
public void Write(Stream inStream, int count, int actualCount, string encryptionAlgorithm, string EncryptionKey)
{
- int bytesLeft = count;
+ AutoResetEvent[] eventArray = new AutoResetEvent[2];
+ eventArray[0] = allComplete;
+ eventArray[1] = writeComplete;
+ WaitHandle.WaitAll(eventArray);
+ writeComplete.Set();
+
+ int bytesLeft = count;
int bytesToWrite;
while(bytesLeft > 0)
{
@@ -382,6 +411,7 @@
writeComplete.WaitOne();
writeComplete.Set();
+ allComplete.Set();
}
/// <summary>
_______________________________________________
ifolder-dev mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/ifolder-dev