コード例 #1
0
 //
 // Marshal the endpoint
 //
 public override void streamWriteImpl(Ice.OutputStream s)
 {
     base.streamWriteImpl(s);
     if (s.GetEncoding().Equals(Ice.Util.Encoding_1_0))
     {
         Ice.Util.Protocol_1_0.ice_writeMembers(s);
         Ice.Util.Encoding_1_0.ice_writeMembers(s);
     }
     // Not transmitted.
     //s.writeBool(_connect);
     s.WriteBool(_compress);
 }
コード例 #2
0
        private void invokeAll(Ice.OutputStream os, int requestId)
        {
            if (_traceLevels.protocol >= 1)
            {
                fillInValue(os, 10, os.size());
                if (requestId > 0)
                {
                    fillInValue(os, Protocol.headerSize, requestId);
                }
                TraceUtil.traceSend(os, _logger, _traceLevels);
            }

            Ice.InputStream iss = new Ice.InputStream(os.communicator(), os.GetEncoding(), os.GetBuffer(), false);

            iss.pos(Protocol.requestHdr.Length);

            int            invokeNum      = 1;
            ServantManager servantManager = _adapter.getServantManager();

            try
            {
                while (invokeNum > 0)
                {
                    //
                    // Increase the direct count for the dispatch. We increase it again here for
                    // each dispatch. It's important for the direct count to be > 0 until the last
                    // collocated request response is sent to make sure the thread pool isn't
                    // destroyed before.
                    //
                    try
                    {
                        _adapter.incDirectCount();
                    }
                    catch (Ice.ObjectAdapterDeactivatedException ex)
                    {
                        handleException(requestId, ex, false);
                        break;
                    }

                    Incoming inS = new Incoming(_reference.getCommunicator(), this, null, _adapter, _response, 0,
                                                requestId);
                    inS.invoke(servantManager, iss);
                    --invokeNum;
                }
            }
            catch (Ice.LocalException ex)
            {
                invokeException(requestId, ex, invokeNum, false); // Fatal invocation exception
            }

            _adapter.decDirectCount();
        }
コード例 #3
0
        public void sendResponse(int requestId, Ice.OutputStream os, byte status, bool amd)
        {
            OutgoingAsyncBase?outAsync;

            lock (this)
            {
                Debug.Assert(_response);

                if (_traceLevels.protocol >= 1)
                {
                    fillInValue(os, 10, os.size());
                }

                // Adopt the OutputStream's buffer.
                Ice.InputStream iss = new Ice.InputStream(os.communicator(), os.GetEncoding(), os.GetBuffer(), true);

                iss.pos(Protocol.replyHdr.Length + 4);

                if (_traceLevels.protocol >= 1)
                {
                    TraceUtil.traceRecv(iss, _logger, _traceLevels);
                }

                if (_asyncRequests.TryGetValue(requestId, out outAsync))
                {
                    outAsync.getIs().Swap(iss);
                    if (!outAsync.response())
                    {
                        outAsync = null;
                    }
                    _asyncRequests.Remove(requestId);
                }
            }

            if (outAsync != null)
            {
                if (amd)
                {
                    outAsync.invokeResponseAsync();
                }
                else
                {
                    outAsync.invokeResponse();
                }
            }
            _adapter.decDirectCount();
        }
コード例 #4
0
        internal static void traceSend(Ice.OutputStream str, Ice.Logger logger, TraceLevels tl)
        {
            if (tl.protocol >= 1)
            {
                int             p   = str.pos();
                Ice.InputStream iss = new Ice.InputStream(str.communicator(), str.GetEncoding(), str.GetBuffer(), false);
                iss.pos(0);

                using (System.IO.StringWriter s = new System.IO.StringWriter(CultureInfo.CurrentCulture))
                {
                    byte type = printMessage(s, iss);

                    logger.trace(tl.protocolCat, "sending " + getMessageTypeAsString(type) + " " + s.ToString());
                }
                str.pos(p);
            }
        }
コード例 #5
0
        internal static void trace(string heading, Ice.OutputStream str, Ice.Logger logger, TraceLevels tl)
        {
            if (tl.protocol >= 1)
            {
                int             p   = str.pos();
                Ice.InputStream iss = new Ice.InputStream(str.communicator(), str.GetEncoding(), str.GetBuffer(), false);
                iss.pos(0);

                using (System.IO.StringWriter s = new System.IO.StringWriter(CultureInfo.CurrentCulture))
                {
                    s.Write(heading);
                    printMessage(s, iss);

                    logger.trace(tl.protocolCat, s.ToString());
                }
                str.pos(p);
            }
        }