ProcessNextRequest() private method

private ProcessNextRequest ( SocketHandler sh ) : void
sh SocketHandler
return void
Example #1
0
        } // DataArrivedCallbackState


        public void BeginReadMessage()
        {
            bool bProcessNow = false;

            try
            {
                if (_requestQueue != null)
                {
                    _requestQueue.ScheduleMoreWorkIfNeeded();
                }

                PrepareForNewMessage();

                if (_dataCount == 0)
                {
                    _beginReadAsyncResult =
                        NetStream.BeginRead(_dataBuffer, 0, _dataBufferSize,
                                            _beginReadCallback, null);
                }
                else
                {
                    // just queue the request if we already have some data
                    //   (note: we intentionally don't call the callback directly to avoid
                    //    overflowing the stack if we service a bunch of calls)
                    bProcessNow = true;
                }
            }
            catch (Exception e)
            {
                CloseOnFatalError(e);
            }
            catch {
                CloseOnFatalError(new Exception(CoreChannel.GetResourceString("Remoting_nonClsCompliantException")));
            }

            if (bProcessNow)
            {
                if (_requestQueue != null)
                {
                    _requestQueue.ProcessNextRequest(this);
                }
                else
                {
                    ProcessRequestNow();
                }

                _beginReadAsyncResult = null;
            }
        } // BeginReadMessage