当前位置: 首页>>代码示例>>C#>>正文


C# IceInternal.getOs方法代码示例

本文整理汇总了C#中IceInternal.getOs方法的典型用法代码示例。如果您正苦于以下问题:C# IceInternal.getOs方法的具体用法?C# IceInternal.getOs怎么用?C# IceInternal.getOs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IceInternal的用法示例。


在下文中一共展示了IceInternal.getOs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: sendAsyncRequest

        public bool sendAsyncRequest(IceInternal.OutgoingAsyncBase og, bool compress, bool response,
                                     int batchRequestNum, out Ice.AsyncCallback sentCallback)
        {
            IceInternal.BasicStream os = og.getOs();

            lock(this)
            {
                if(_exception != null)
                {
                    //
                    // If the connection is closed before we even have a chance
                    // to send our request, we always try to send the request
                    // again.
                    //
                    throw new IceInternal.RetryException(_exception);
                }

                Debug.Assert(_state > StateNotValidated);
                Debug.Assert(_state < StateClosing);

                //
                // Ensure the message isn't bigger than what we can send with the
                // transport.
                //
                _transceiver.checkSendSize(os.getBuffer());

                //
                // Notify the request that it's cancelable with this connection.
                // This will throw if the request is canceled.
                //
                og.cancelable(this);

                int requestId = 0;
                if(response)
                {
                    //
                    // Create a new unique request ID.
                    //
                    requestId = _nextRequestId++;
                    if(requestId <= 0)
                    {
                        _nextRequestId = 1;
                        requestId = _nextRequestId++;
                    }

                    //
                    // Fill in the request ID.
                    //
                    os.pos(IceInternal.Protocol.headerSize);
                    os.writeInt(requestId);
                }
                else if(batchRequestNum > 0)
                {
                    os.pos(IceInternal.Protocol.headerSize);
                    os.writeInt(batchRequestNum);
                }

                og.attachRemoteObserver(initConnectionInfo(), _endpoint, requestId);

                bool sent;
                try
                {
                    OutgoingMessage msg = new OutgoingMessage(og, os, compress, requestId);
                    sent = sendMessage(msg);
                    sentCallback = msg.sentCallback;
                }
                catch(LocalException ex)
                {
                    setState(StateClosed, ex);
                    Debug.Assert(_exception != null);
                    throw _exception;
                }

                if(response)
                {
                    //
                    // Add to the async requests map.
                    //
                    _asyncRequests[requestId] = og;
                }
                return sent;
            }
        }
开发者ID:alexmnazarenko,项目名称:ice,代码行数:83,代码来源:ConnectionI.cs

示例2: flushAsyncBatchRequests

        public bool flushAsyncBatchRequests(IceInternal.OutgoingAsyncBase outAsync, out Ice.AsyncCallback sentCallback)
        {
            lock(this)
            {
                while(_batchStreamInUse && _exception == null)
                {
                    System.Threading.Monitor.Wait(this);
                }

                if(_exception != null)
                {
                    throw _exception;
                }

                if(_batchRequestNum == 0)
                {
                    sentCallback = outAsync.sent();
                    return true;
                }

                //
                // Notify the request that it's cancelable with this connection. 
                // This will throw if the request is canceled.
                //
                outAsync.cancelable(this);

                //
                // Fill in the number of requests in the batch.
                //
                _batchStream.pos(IceInternal.Protocol.headerSize);
                _batchStream.writeInt(_batchRequestNum);

                _batchStream.swap(outAsync.getOs());

                outAsync.attachRemoteObserver(initConnectionInfo(), _endpoint, 0);

                //
                // Send the batch stream.
                //
                bool sent;
                try
                {
                    OutgoingMessage message = new OutgoingMessage(outAsync, outAsync.getOs(), _batchRequestCompress, 0);
                    sent = sendMessage(message);
                    sentCallback = message.sentCallback;
                }
                catch(LocalException ex)
                {
                    setState(StateClosed, ex);
                    Debug.Assert(_exception != null);
                    throw _exception;
                }
                
                //
                // Reset the batch stream.
                //
                _batchStream = new IceInternal.BasicStream(_instance, Util.currentProtocolEncoding);
                _batchRequestNum = 0;
                _batchRequestCompress = false;
                _batchMarker = 0;
                return sent;
            }
        }
开发者ID:pedia,项目名称:zeroc-ice,代码行数:63,代码来源:ConnectionI.cs


注:本文中的IceInternal.getOs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。