From 33fd3665807ba51ecbd5281aa17d8a71fdf44c86 Mon Sep 17 00:00:00 2001 From: EdwardNutting_cp <4a0e5eaa1e4f1b941b4d24194acb591771a0e595xmSctDn6> Date: Tue, 24 Dec 2013 18:05:49 +0000 Subject: [PATCH] Final change for new release. --- .../DebugConnectorStream.cs | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/source2/Debug/Cosmos.Debug.Common/DebugConnectorStream.cs b/source2/Debug/Cosmos.Debug.Common/DebugConnectorStream.cs index 52beea7ac..333b781bb 100644 --- a/source2/Debug/Cosmos.Debug.Common/DebugConnectorStream.cs +++ b/source2/Debug/Cosmos.Debug.Common/DebugConnectorStream.cs @@ -140,56 +140,56 @@ namespace Cosmos.Debug.Common #endif } - protected void DoRead(IAsyncResult aResult) - { - try - { - var xIncoming = (Incoming)aResult.AsyncState; - int xCount = xIncoming.Stream.EndRead(aResult); +// protected void DoRead(IAsyncResult aResult) +// { +// try +// { +// var xIncoming = (Incoming)aResult.AsyncState; +// int xCount = xIncoming.Stream.EndRead(aResult); - System.Diagnostics.Debug.WriteLine(String.Format("DC - Received: {0}", BytesToString(xIncoming.Packet, xIncoming.CurrentPos, xCount))); - xIncoming.CurrentPos += xCount; - if (xCount == 0) - { - // If 0, end of stream then just exit without calling BeginRead again - return; - } - else if (xIncoming.CurrentPos < xIncoming.Packet.Length) - { - // Packet is not full yet, read more data -#if TRACK_PENDING - try { - Interlocked.Increment(ref _pendingReadsCount); -#endif - xIncoming.Stream.BeginRead(xIncoming.Packet, xIncoming.CurrentPos - , xIncoming.Packet.Length - xIncoming.CurrentPos - , new AsyncCallback(DoRead), xIncoming); -#if TRACK_PENDING - } - catch (Exception e) { - Interlocked.Decrement(ref _pendingReadsCount); - throw; - } -#endif - } - else - { - System.Diagnostics.Debug.WriteLine(String.Format("DC - Full packet received - Received: {0}", BytesToString(xIncoming.Packet, 0, xIncoming.Packet.Length))); +// System.Diagnostics.Debug.WriteLine(String.Format("DC - Received: {0}", BytesToString(xIncoming.Packet, xIncoming.CurrentPos, xCount))); +// xIncoming.CurrentPos += xCount; +// if (xCount == 0) +// { +// // If 0, end of stream then just exit without calling BeginRead again +// return; +// } +// else if (xIncoming.CurrentPos < xIncoming.Packet.Length) +// { +// // Packet is not full yet, read more data +//#if TRACK_PENDING +// try { +// Interlocked.Increment(ref _pendingReadsCount); +//#endif +// xIncoming.Stream.BeginRead(xIncoming.Packet, xIncoming.CurrentPos +// , xIncoming.Packet.Length - xIncoming.CurrentPos +// , new AsyncCallback(DoRead), xIncoming); +//#if TRACK_PENDING +// } +// catch (Exception e) { +// Interlocked.Decrement(ref _pendingReadsCount); +// throw; +// } +//#endif +// } +// else +// { +// System.Diagnostics.Debug.WriteLine(String.Format("DC - Full packet received - Received: {0}", BytesToString(xIncoming.Packet, 0, xIncoming.Packet.Length))); - // Full packet received, process it - xIncoming.Completed(xIncoming.Packet); - } - } - catch (System.IO.IOException ex) - { - ConnectionLost(ex); - } -#if TRACK_PENDING - finally { - Interlocked.Decrement(ref _pendingReadsCount); - } -#endif - } +// // Full packet received, process it +// xIncoming.Completed(xIncoming.Packet); +// } +// } +// catch (System.IO.IOException ex) +// { +// ConnectionLost(ex); +// } +//#if TRACK_PENDING +// finally { +// Interlocked.Decrement(ref _pendingReadsCount); +// } +//#endif +// } private List ReadQueue = new List(); private bool reading = false; @@ -215,11 +215,11 @@ namespace Cosmos.Debug.Common } else { - mStream.BeginRead(next.Packet, next.CurrentPos, next.Packet.Length - next.CurrentPos, new AsyncCallback(DoRead2), next); + mStream.BeginRead(next.Packet, next.CurrentPos, next.Packet.Length - next.CurrentPos, new AsyncCallback(DoRead), next); } } } - private void DoRead2(IAsyncResult result) + private void DoRead(IAsyncResult result) { try {