private static void OnRead(IAsyncResult result) { if (!result.CompletedSynchronously) { ReadAsyncResult thisPtr = (ReadAsyncResult)result.AsyncState; try { thisPtr._read += thisPtr._parent.BaseStream.EndRead(result); thisPtr.InvokeCallback(); } catch (Exception e) { if (thisPtr.IsCompleted) { throw; } thisPtr.InvokeCallback(e); } } }
private static void OnRead(IAsyncResult result) { if (!result.CompletedSynchronously) { ReadAsyncResult thisPtr = (ReadAsyncResult)result.AsyncState; try { if (!thisPtr.CompleteRead(result)) { thisPtr.Read(); } } catch (Exception e) { if (thisPtr.IsCompleted) { throw; } thisPtr.InvokeCallback(e); } } }