예제 #1
0
        bool GetReadResult()
        {
            offset = 0;
            size   = Connection.EndRead();
            if (size == 0)
            {
                if (this.decoder.StreamPosition == 0) // client timed out a cached connection
                {
                    base.Close(GetRemainingTimeout());
                    return(false);
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(decoder.CreatePrematureEOFException());
                }
            }

            // restore ExceptionEventType to Error after the initial read for cached connections
            Connection.ExceptionEventType = TraceEventType.Error;

            if (buffer == null)
            {
                buffer = Connection.AsyncReadBuffer;
            }

            return(true);
        }
 private static void ReadServerMode(MsmqChannelListenerBase listener, ServerModeDecoder modeDecoder, byte[] incoming, long lookupId, ref int offset, ref int size)
 {
     do
     {
         if (size <= 0)
         {
             throw listener.NormalizePoisonException(lookupId, modeDecoder.CreatePrematureEOFException());
         }
         int num = modeDecoder.Decode(incoming, offset, size);
         offset += num;
         size   -= num;
     }while (ServerModeDecoder.State.Done != modeDecoder.CurrentState);
 }
 static void ReadServerMode(MsmqChannelListenerBase listener, ServerModeDecoder modeDecoder, byte[] incoming, long lookupId, ref int offset, ref int size)
 {
     for (;;)
     {
         if (size <= 0)
         {
             throw listener.NormalizePoisonException(lookupId, modeDecoder.CreatePrematureEOFException());
         }
         int decoded = modeDecoder.Decode(incoming, offset, size);
         offset += decoded;
         size -= decoded;
         if (ServerModeDecoder.State.Done == modeDecoder.CurrentState)
             break;
     }
 }
예제 #4
0
 static void ReadServerMode(MsmqChannelListenerBase listener, ServerModeDecoder modeDecoder, byte[] incoming, long lookupId, ref int offset, ref int size)
 {
     for (;;)
     {
         if (size <= 0)
         {
             throw listener.NormalizePoisonException(lookupId, modeDecoder.CreatePrematureEOFException());
         }
         int decoded = modeDecoder.Decode(incoming, offset, size);
         offset += decoded;
         size   -= decoded;
         if (ServerModeDecoder.State.Done == modeDecoder.CurrentState)
         {
             break;
         }
     }
 }
 private static void ReadServerMode(MsmqChannelListenerBase listener, ServerModeDecoder modeDecoder, byte[] incoming, long lookupId, ref int offset, ref int size)
 {
     do
     {
         if (size <= 0)
         {
             throw listener.NormalizePoisonException(lookupId, modeDecoder.CreatePrematureEOFException());
         }
         int num = modeDecoder.Decode(incoming, offset, size);
         offset += num;
         size -= num;
     }
     while (ServerModeDecoder.State.Done != modeDecoder.CurrentState);
 }