Пример #1
0
 public static FaceRecognitionPrx read__(IceInternal.BasicStream is__)
 {
     Ice.ObjectPrx proxy = is__.readProxy();
     if (proxy != null)
     {
         FaceRecognitionPrxHelper result = new FaceRecognitionPrxHelper();
         result.copyFrom__(proxy);
         return(result);
     }
     return(null);
 }
Пример #2
0
 public static CSTransDataFromClientPrx read__(IceInternal.BasicStream is__)
 {
     Ice.ObjectPrx proxy = is__.readProxy();
     if (proxy != null)
     {
         CSTransDataFromClientPrxHelper result = new CSTransDataFromClientPrxHelper();
         result.copyFrom__(proxy);
         return(result);
     }
     return(null);
 }
Пример #3
0
 public static Ice.DispatchStatus initConnectionListener___(FaceRecognition obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
     IceInternal.BasicStream is__ = inS__.startReadParams();
     FaceRecognitionModule.ConnectionListenerPrx listener;
     listener = FaceRecognitionModule.ConnectionListenerPrxHelper.read__(is__);
     inS__.endReadParams();
     obj__.initConnectionListener(listener, current__);
     inS__.writeEmptyParams__();
     return(Ice.DispatchStatus.DispatchOK);
 }
Пример #4
0
 public static void write__(IceInternal.BasicStream os__, LogInitInfo v__)
 {
     if (v__ == null)
     {
         nullMarshalValue__.write__(os__);
     }
     else
     {
         v__.write__(os__);
     }
 }
Пример #5
0
 public static BaseServicePrx read__(IceInternal.BasicStream is__)
 {
     Ice.ObjectPrx proxy = is__.readProxy();
     if (proxy != null)
     {
         BaseServicePrxHelper result = new BaseServicePrxHelper();
         result.copyFrom__(proxy);
         return(result);
     }
     return(null);
 }
Пример #6
0
 public static CallbackSenderPrx read__(IceInternal.BasicStream is__)
 {
     Ice.ObjectPrx proxy = is__.readProxy();
     if (proxy != null)
     {
         CallbackSenderPrxHelper result = new CallbackSenderPrxHelper();
         result.copyFrom__(proxy);
         return(result);
     }
     return(null);
 }
Пример #7
0
 public static Ice.DispatchStatus initiateCallback___(CallbackSender obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
     IceInternal.BasicStream  is__ = inS__.startReadParams();
     Demo.CallbackReceiverPrx proxy;
     proxy = Demo.CallbackReceiverPrxHelper.read__(is__);
     inS__.endReadParams();
     obj__.initiateCallback(proxy, current__);
     inS__.writeEmptyParams__();
     return(Ice.DispatchStatus.DispatchOK);
 }
Пример #8
0
 public static void write__(IceInternal.BasicStream os__, PSIceErrorCode v__)
 {
     if (v__ == null)
     {
         nullMarshalValue__.write__(os__);
     }
     else
     {
         v__.write__(os__);
     }
 }
Пример #9
0
        public static Ice.DispatchStatus SetWriteLogFlag___(LogServer_RPC obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            bool bWrite;

            bWrite = is__.readBool();
            inS__.endReadParams();
            obj__.SetWriteLogFlag(bWrite, current__);
            inS__.writeEmptyParams__();
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #10
0
        public static Ice.DispatchStatus onRecv___(ConnectionListener obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            string xmlContent;

            xmlContent = is__.readString();
            inS__.endReadParams();
            obj__.onRecv(xmlContent, current__);
            inS__.writeEmptyParams__();
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #11
0
        public static Ice.DispatchStatus TransHeartbeat___(CallbackClient obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            long lTime;

            lTime = is__.readLong();
            inS__.endReadParams();
            obj__.TransHeartbeat(lTime, current__);
            inS__.writeEmptyParams__();
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #12
0
        public static Ice.DispatchStatus printString___(Printer obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            string s;

            s = is__.readString();
            inS__.endReadParams();
            obj__.printString(s, current__);
            inS__.writeEmptyParams__();
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #13
0
 public static MCS.GuiHub.PushData[] read(IceInternal.BasicStream is__)
 {
     MCS.GuiHub.PushData[] v__;
     {
         int szx__ = is__.readAndCheckSeqSize(1);
         v__ = new MCS.GuiHub.PushData[szx__];
         for (int ix__ = 0; ix__ < szx__; ++ix__)
         {
             v__[ix__] = (MCS.GuiHub.PushData)is__.readByte(13);
         }
     }
     return(v__);
 }
Пример #14
0
        public static DispatchStatus ice_isA___(Ice.Object __obj, IceInternal.Incoming inS__, Current __current)
        {
            IceInternal.BasicStream is__ = inS__.startReadParams();
            string __id = is__.readString();

            inS__.endReadParams();
            bool __ret = __obj.ice_isA(__id, __current);

            IceInternal.BasicStream os__ = inS__.startWriteParams__(FormatType.DefaultFormat);
            os__.writeBool(__ret);
            inS__.endWriteParams__(true);
            return(DispatchStatus.DispatchOK);
        }
Пример #15
0
        public static Ice.DispatchStatus NMRegistClient___(NMServer obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            string strClientId;

            IRPC.NMClientPrx Client;
            strClientId = is__.readString();
            Client      = IRPC.NMClientPrxHelper.read__(is__);
            inS__.endReadParams();
            obj__.NMRegistClient(strClientId, Client, current__);
            inS__.writeEmptyParams__();
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #16
0
        public static Ice.DispatchStatus sendImage___(Printer obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            byte[] seq;
            string name;

            seq  = demo.ByteSeqHelper.read(is__);
            name = is__.readString();
            inS__.endReadParams();
            obj__.sendImage(seq, name, current__);
            inS__.writeEmptyParams__();
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #17
0
 public MCS.LocFoup GetFoup(int foupBarCode, _System.Collections.Generic.Dictionary <string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("GetFoup", Ice.OperationMode.Idempotent, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             os__.writeInt(foupBarCode);
         }
         catch (Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if (!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch (Ice.UserException ex__)
                 {
                     throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                 }
             }
             IceInternal.BasicStream is__ = og__.istr();
             is__.startReadEncaps();
             MCS.LocFoup ret__;
             ret__ = null;
             if (ret__ == null)
             {
                 ret__ = new MCS.LocFoup();
             }
             ret__.read__(is__);
             is__.endReadEncaps();
             return(ret__);
         }
         catch (Ice.LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
 public NProgDistributed.TheIce.MessageDto Send(NProgDistributed.TheIce.MessageDto message, _System.Collections.Generic.Dictionary <string, string> context__, Ice.Instrumentation.InvocationObserver observer__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("Send", Ice.OperationMode.Normal, context__, observer__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.startWriteParams(Ice.FormatType.DefaultFormat);
             os__.writeObject(message);
             os__.writePendingObjects();
             og__.endWriteParams();
         }
         catch (Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if (!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch (Ice.UserException ex__)
                 {
                     throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                 }
             }
             IceInternal.BasicStream            is__ = og__.startReadParams();
             NProgDistributed.TheIce.MessageDto ret__;
             IceInternal.ParamPatcher <NProgDistributed.TheIce.MessageDto> ret__PP = new IceInternal.ParamPatcher <NProgDistributed.TheIce.MessageDto>(NProgDistributed.TheIce.MessageDto.ice_staticId());
             is__.readObject(ret__PP);
             is__.readPendingObjects();
             og__.endReadParams();
             ret__ = ret__PP.value;
             return(ret__);
         }
         catch (Ice.LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
Пример #19
0
        public static Ice.DispatchStatus toUpper___(Converter obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            string s;

            s = is__.readString();
            inS__.endReadParams();
            string ret__ = obj__.toUpper(s, current__);

            IceInternal.BasicStream os__ = inS__.startWriteParams__(Ice.FormatType.DefaultFormat);
            os__.writeString(ret__);
            inS__.endWriteParams__(true);
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #20
0
        public static Ice.DispatchStatus SendData___(NMClient obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            string strXml;

            strXml = is__.readString();
            inS__.endReadParams();
            int ret__ = obj__.SendData(strXml, current__);

            IceInternal.BasicStream os__ = inS__.startWriteParams__(Ice.FormatType.DefaultFormat);
            os__.writeInt(ret__);
            inS__.endWriteParams__(true);
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #21
0
 public void read__(IceInternal.BasicStream is__)
 {
     Id             = is__.readInt();
     ClientId       = is__.readInt();
     ClientName     = is__.readString();
     Password       = is__.readString();
     ComPassword    = is__.readString();
     FundType       = (PortServerIce.PSIceFundType)is__.readEnum(1);
     BrokerName     = is__.readString();
     DepartmentNo   = is__.readString();
     FundName       = is__.readString();
     SHStockAccount = is__.readString();
     SZStockAccount = is__.readString();
     Node           = is__.readString();
 }
Пример #22
0
        public static Ice.DispatchStatus helloWorld___(BitmapProvider obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.istr();
            is__.startReadEncaps();
            string something;

            something = is__.readString();
            is__.endReadEncaps();
            IceInternal.BasicStream os__ = inS__.ostr();
            string ret__ = obj__.helloWorld(something, current__);

            os__.writeString(ret__);
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #23
0
 public void write__(IceInternal.BasicStream os__)
 {
     os__.writeInt(Id);
     os__.writeInt(ClientId);
     os__.writeString(ClientName);
     os__.writeString(Password);
     os__.writeString(ComPassword);
     os__.writeEnum((int)FundType, 1);
     os__.writeString(BrokerName);
     os__.writeString(DepartmentNo);
     os__.writeString(FundName);
     os__.writeString(SHStockAccount);
     os__.writeString(SZStockAccount);
     os__.writeString(Node);
 }
 public static Ice.DispatchStatus Send___(IMessageService obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     checkMode__(Ice.OperationMode.Normal, current__.mode);
     IceInternal.BasicStream is__ = inS__.startReadParams();
     IceInternal.ParamPatcher <NProgDistributed.TheIce.MessageDto> message__PP = new IceInternal.ParamPatcher <NProgDistributed.TheIce.MessageDto>(NProgDistributed.TheIce.MessageDto.ice_staticId());
     is__.readObject(message__PP);
     is__.readPendingObjects();
     inS__.endReadParams();
     NProgDistributed.TheIce.MessageDto ret__ = obj__.Send(message__PP.value, current__);
     IceInternal.BasicStream            os__  = inS__.startWriteParams__(Ice.FormatType.DefaultFormat);
     os__.writeObject(ret__);
     os__.writePendingObjects();
     inS__.endWriteParams__(true);
     return(Ice.DispatchStatus.DispatchOK);
 }
Пример #25
0
        public static Ice.DispatchStatus WriteLogInit___(LogServer_RPC obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            IRPC.LogInitInfo        InitInfo;
            InitInfo = null;
            InitInfo = IRPC.LogInitInfo.read__(is__, InitInfo);
            inS__.endReadParams();
            bool ret__ = obj__.WriteLogInit(InitInfo, current__);

            IceInternal.BasicStream os__ = inS__.startWriteParams__(Ice.FormatType.DefaultFormat);
            os__.writeBool(ret__);
            inS__.endWriteParams__(true);
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #26
0
 public static void write(IceInternal.BasicStream os__, MCS.GuiHub.PushData[] v__)
 {
     if (v__ == null)
     {
         os__.writeSize(0);
     }
     else
     {
         os__.writeSize(v__.Length);
         for (int ix__ = 0; ix__ < v__.Length; ++ix__)
         {
             os__.writeByte((byte)v__[ix__], 13);
         }
     }
 }
Пример #27
0
        public static Ice.DispatchStatus send___(FaceRecognition obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            Ice.ObjectImpl.checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            string xml;

            xml = is__.readString();
            inS__.endReadParams();
            string ret__ = obj__.send(xml, current__);

            IceInternal.BasicStream os__ = inS__.startWriteParams__(Ice.FormatType.DefaultFormat);
            os__.writeString(ret__);
            inS__.endWriteParams__(true);
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #28
0
        public static Ice.DispatchStatus log___(RemoteLog obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.startReadParams();
            string name;
            string time;
            string msg;

            name = is__.readString();
            time = is__.readString();
            msg  = is__.readString();
            inS__.endReadParams();
            obj__.log(name, time, msg, current__);
            inS__.writeEmptyParams__();
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #29
0
        public static Ice.DispatchStatus getBitmap___(BitmapProvider obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.istr();
            is__.startReadEncaps();
            float ex;

            ex = is__.readFloat();
            float ey;

            ey = is__.readFloat();
            float ez;

            ez = is__.readFloat();
            float dx;

            dx = is__.readFloat();
            float dy;

            dy = is__.readFloat();
            float dz;

            dz = is__.readFloat();
            float ax;

            ax = is__.readFloat();
            float ay;

            ay = is__.readFloat();
            float az;

            az = is__.readFloat();
            float timer;

            timer = is__.readFloat();
            float depthOfField;

            depthOfField = is__.readFloat();
            float transparentColor;

            transparentColor = is__.readFloat();
            is__.endReadEncaps();
            IceInternal.BasicStream os__ = inS__.ostr();
            byte[] ret__ = obj__.getBitmap(ex, ey, ez, dx, dy, dz, ax, ay, az, timer, depthOfField, transparentColor, current__);
            os__.writeByteSeq(ret__);
            return(Ice.DispatchStatus.DispatchOK);
        }
Пример #30
0
 public int Move(int FoupID, int From, int To, _System.Collections.Generic.Dictionary <string, string> context__)
 {
     IceInternal.Outgoing og__ = handler__.getOutgoing("Move", Ice.OperationMode.Idempotent, context__);
     try
     {
         try
         {
             IceInternal.BasicStream os__ = og__.ostr();
             os__.writeInt(FoupID);
             os__.writeInt(From);
             os__.writeInt(To);
         }
         catch (Ice.LocalException ex__)
         {
             og__.abort(ex__);
         }
         bool ok__ = og__.invoke();
         try
         {
             if (!ok__)
             {
                 try
                 {
                     og__.throwUserException();
                 }
                 catch (Ice.UserException ex__)
                 {
                     throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                 }
             }
             IceInternal.BasicStream is__ = og__.istr();
             is__.startReadEncaps();
             int ret__;
             ret__ = is__.readInt();
             is__.endReadEncaps();
             return(ret__);
         }
         catch (Ice.LocalException ex__)
         {
             throw new IceInternal.LocalExceptionWrapper(ex__, false);
         }
     }
     finally
     {
         handler__.reclaimOutgoing(og__);
     }
 }
Пример #31
0
        public void abortBatchRequest()
        {
            _m.Lock();
            try
            {
                _batchStream = new IceInternal.BasicStream(_instance, Util.currentProtocolEncoding, _batchAutoFlush);
                _batchRequestNum = 0;
                _batchRequestCompress = false;
                _batchMarker = 0;

                Debug.Assert(_batchStreamInUse);
                _batchStreamInUse = false;
                _m.NotifyAll();
            }
            finally
            {
                _m.Unlock();
            }
        }
Пример #32
0
 internal void adopt()
 {
     if(_adopt)
     {
         IceInternal.BasicStream stream = new IceInternal.BasicStream(this.stream.instance(),
                                                                      Util.currentProtocolEncoding);
         stream.swap(this.stream);
         this.stream = stream;
         _adopt = false;
     }
 }
Пример #33
0
        private void heartbeat()
        {
            Debug.Assert(_state == StateActive);

            if(!_endpoint.datagram())
            {
                IceInternal.BasicStream os = new IceInternal.BasicStream(_instance, Util.currentProtocolEncoding);
                os.writeBlob(IceInternal.Protocol.magic);
                Ice.Util.currentProtocol.write__(os);
                Ice.Util.currentProtocolEncoding.write__(os);
                os.writeByte(IceInternal.Protocol.validateConnectionMsg);
                os.writeByte((byte)0);
                os.writeInt(IceInternal.Protocol.headerSize); // Message size.
                try
                {
                    OutgoingMessage message = new OutgoingMessage(os, false, false);
                    sendMessage(message);
                }
                catch(Ice.LocalException ex)
                {
                    setState(StateClosed, ex);
                    Debug.Assert(_exception != null);
                }
            }
        }
Пример #34
0
        private void initiateShutdown()
        {
            Debug.Assert(_state == StateClosing);
            Debug.Assert(_dispatchCount == 0);

            if(_shutdownInitiated)
            {
                return;
            }
            _shutdownInitiated = true;

            if(!_endpoint.datagram())
            {
                //
                // Before we shut down, we send a close connection message.
                //
                IceInternal.BasicStream os = new IceInternal.BasicStream(_instance, Util.currentProtocolEncoding);
                os.writeBlob(IceInternal.Protocol.magic);
                Ice.Util.currentProtocol.write__(os);
                Ice.Util.currentProtocolEncoding.write__(os);
                os.writeByte(IceInternal.Protocol.closeConnectionMsg);
                os.writeByte(_compressionSupported ? (byte)1 : (byte)0);
                os.writeInt(IceInternal.Protocol.headerSize); // Message size.

                if(sendMessage(new OutgoingMessage(os, false, false)))
                {
                    setState(StateClosingPending);

                    //
                    // Notify the the transceiver of the graceful connection closure.
                    //
                    int op = _transceiver.closing(true, _exception);
                    if(op != 0)
                    {
                        scheduleTimeout(op);
                        _threadPool.register(this, op);
                    }
                }
            }
        }
Пример #35
0
        internal ConnectionI(Communicator communicator, IceInternal.Instance instance,
                             IceInternal.ACMMonitor monitor, IceInternal.Transceiver transceiver,
                             IceInternal.Connector connector, IceInternal.EndpointI endpoint, ObjectAdapterI adapter)
        {
            _communicator = communicator;
            _instance = instance;
            _monitor = monitor;
            _transceiver = transceiver;
            _desc = transceiver.ToString();
            _type = transceiver.protocol();
            _connector = connector;
            _endpoint = endpoint;
            _adapter = adapter;
            InitializationData initData = instance.initializationData();
            _logger = initData.logger; // Cached for better performance.
            _traceLevels = instance.traceLevels(); // Cached for better performance.
            _timer = instance.timer();
            _writeTimeout = new TimeoutCallback(this);
            _writeTimeoutScheduled = false;
            _readTimeout = new TimeoutCallback(this);
            _readTimeoutScheduled = false;
            _warn = initData.properties.getPropertyAsInt("Ice.Warn.Connections") > 0;
            _warnUdp = initData.properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
            _cacheBuffers = instance.cacheMessageBuffers() > 0;
            if(_monitor != null && _monitor.getACM().timeout > 0)
            {
                _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis();
            }
            else
            {
                _acmLastActivity = -1;
            }
            _nextRequestId = 1;
            _messageSizeMax = adapter != null ? adapter.messageSizeMax() : instance.messageSizeMax();
            _batchRequestQueue = new IceInternal.BatchRequestQueue(instance, _endpoint.datagram());
            _readStream = new IceInternal.BasicStream(instance, Util.currentProtocolEncoding);
            _readHeader = false;
            _readStreamPos = -1;
            _writeStream = new IceInternal.BasicStream(instance, Util.currentProtocolEncoding);
            _writeStreamPos = -1;
            _dispatchCount = 0;
            _state = StateNotInitialized;

            _compressionLevel = initData.properties.getPropertyAsIntWithDefault("Ice.Compression.Level", 1);
            if(_compressionLevel < 1)
            {
                _compressionLevel = 1;
            }
            else if(_compressionLevel > 9)
            {
                _compressionLevel = 9;
            }

            if(adapter != null)
            {
                _servantManager = adapter.getServantManager();
            }

            try
            {
                if(adapter != null)
                {
                    _threadPool = adapter.getThreadPool();
                }
                else
                {
                    _threadPool = instance.clientThreadPool();
                }
                _threadPool.initialize(this);
            }
            catch(LocalException)
            {
                throw;
            }
            catch(System.Exception ex)
            {
                throw new SyscallException(ex);
            }
        }
Пример #36
0
        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;
            }
        }
Пример #37
0
 internal OutgoingMessage(IceInternal.OutgoingAsyncBase outAsync, IceInternal.BasicStream stream,
                          bool compress, int requestId)
 {
     this.stream = stream;
     this.compress = compress;
     this.outAsync = outAsync;
     this.requestId = requestId;
     this.isSent = false;
 }
Пример #38
0
 internal OutgoingMessage(IceInternal.BasicStream stream, bool compress, bool adopt)
 {
     this.stream = stream;
     this.compress = compress;
     this._adopt = adopt;
     this.isSent = false;
     this.requestId = 0;
 }
Пример #39
0
 internal OutgoingMessage(IceInternal.OutgoingMessageCallback @out, IceInternal.BasicStream stream,
                          bool compress, int requestId)
 {
     this.stream = stream;
     this.compress = compress;
     this.@out = @out;
     this.requestId = requestId;
     this.isSent = false;
 }
Пример #40
0
 internal void adopt()
 {
     if(_adopt)
     {
         IceInternal.BasicStream stream = new IceInternal.BasicStream(this.stream.instance());
         stream.swap(this.stream);
         this.stream = stream;
         _adopt = false;
     }
 }
Пример #41
0
        internal ConnectionI(Communicator communicator, IceInternal.Instance instance,
                             IceInternal.ConnectionReaper reaper, IceInternal.Transceiver transceiver,
                             IceInternal.Connector connector, IceInternal.EndpointI endpoint, ObjectAdapter adapter)
        {
            _communicator = communicator;
            _instance = instance;
            _reaper = reaper;
            InitializationData initData = instance.initializationData();
            _transceiver = transceiver;
            _desc = transceiver.ToString();
            _type = transceiver.type();
            _connector = connector;
            _endpoint = endpoint;
            _adapter = adapter;
            _dispatcher = initData.dispatcher; // Cached for better performance.
            _logger = initData.logger; // Cached for better performance.
            _traceLevels = instance.traceLevels(); // Cached for better performance.
            _timer = instance.timer();
            _writeTimeout = new TimeoutCallback(this);
            _writeTimeoutScheduled = false;
            _writeStreamPos = -1;
            _readTimeout = new TimeoutCallback(this);
            _readTimeoutScheduled = false;
            _readStreamPos = -1;
            _warn = initData.properties.getPropertyAsInt("Ice.Warn.Connections") > 0;
            _warnUdp = initData.properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
            _cacheBuffers = initData.properties.getPropertyAsIntWithDefault("Ice.CacheMessageBuffers", 1) == 1;
            _acmAbsoluteTimeoutMillis = 0;
            _nextRequestId = 1;
            _batchAutoFlush = initData.properties.getPropertyAsIntWithDefault("Ice.BatchAutoFlush", 1) > 0;
            _batchStream = new IceInternal.BasicStream(instance, Util.currentProtocolEncoding, _batchAutoFlush);
            _batchStreamInUse = false;
            _batchRequestNum = 0;
            _batchRequestCompress = false;
            _batchMarker = 0;
            _readStream = new IceInternal.BasicStream(instance, Util.currentProtocolEncoding);
            _readHeader = false;
            _writeStream = new IceInternal.BasicStream(instance, Util.currentProtocolEncoding);
            _dispatchCount = 0;
            _state = StateNotInitialized;

            _compressionLevel = initData.properties.getPropertyAsIntWithDefault("Ice.Compression.Level", 1);
            if(_compressionLevel < 1)
            {
                _compressionLevel = 1;
            }
            else if(_compressionLevel > 9)
            {
                _compressionLevel = 9;
            }

            ObjectAdapterI adapterImpl = _adapter as ObjectAdapterI;
            if(adapterImpl != null)
            {
                _servantManager = adapterImpl.getServantManager();
            }

            try
            {
                if(_endpoint.datagram())
                {
                    _acmTimeout = 0;
                }
                else
                {
                    if(adapterImpl != null)
                    {
                        _acmTimeout = adapterImpl.getACM();
                    }
                    else
                    {
                        _acmTimeout = _instance.clientACM();
                    }
                }

                if(adapterImpl != null)
                {
                    _threadPool = adapterImpl.getThreadPool();
                }
                else
                {
                    _threadPool = instance.clientThreadPool();
                }
                _threadPool.initialize(this);
            }
            catch(LocalException)
            {
                throw;
            }
            catch(System.Exception ex)
            {
                throw new SyscallException(ex);
            }
        }
Пример #42
0
        public bool flushAsyncBatchRequests(IceInternal.BatchOutgoingAsync outAsync, out Ice.AsyncCallback sentCallback)
        {
            _m.Lock();
            try
            {
                while(_batchStreamInUse && _exception == null)
                {
                    _m.Wait();
                }

                if(_exception != null)
                {
                    throw _exception;
                }
                
                if(_batchRequestNum == 0)
                {
                    sentCallback = outAsync.sent__(this);
                    return true;
                }

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

                outAsync.attachRemoteObserver__(initConnectionInfo(), _endpoint, 0, 
                                                _batchStream.size() - IceInternal.Protocol.headerSize - 4);

                _batchStream.swap(outAsync.ostr__);

                //
                // Send the batch stream.
                //
                bool sent;
                try
                {
                    OutgoingMessage message = new OutgoingMessage(outAsync, outAsync.ostr__, _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, _batchAutoFlush);
                _batchRequestNum = 0;
                _batchRequestCompress = false;
                _batchMarker = 0;
                return sent;
            }
            finally
            {
                _m.Unlock();
            }
        }
Пример #43
0
        public bool flushBatchRequests(IceInternal.BatchOutgoing @out)
        {
            _m.Lock();
            try
            {
                while(_batchStreamInUse && _exception == null)
                {
                    _m.Wait();
                }

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

                if(_batchRequestNum == 0)
                {
                    @out.sent(false);
                    return true;
                }

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

                @out.attachRemoteObserver(initConnectionInfo(), _endpoint, 
                                          _batchStream.size() - IceInternal.Protocol.headerSize);

                _batchStream.swap(@out.ostr());

                bool sent = false;
                try
                {
                    OutgoingMessage message = new OutgoingMessage(@out, @out.ostr(), _batchRequestCompress, 0);
                    sent = sendMessage(message);
                }
                catch(LocalException ex)
                {
                    setState(StateClosed, ex);
                    Debug.Assert(_exception != null);
                    throw _exception;
                }

                //
                // Reset the batch stream.
                //
                _batchStream = new IceInternal.BasicStream(_instance, Util.currentProtocolEncoding, _batchAutoFlush);
                _batchRequestNum = 0;
                _batchRequestCompress = false;
                _batchMarker = 0;

                return sent;
            }
            finally
            {
                _m.Unlock();
            }
        }
Пример #44
0
        public void finishBatchRequest(IceInternal.BasicStream os, bool compress)
        {
            try
            {
                _m.Lock();
                try
                {
                    //
                    // Get the batch stream back.
                    //
                    _batchStream.swap(os);

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

                    bool flush = false;
                    if(_batchAutoFlush)
                    {
                        //
                        // Throw memory limit exception if the first message added causes us to
                        // go over limit. Otherwise put aside the marshalled message that caused
                        // limit to be exceeded and rollback stream to the marker.
                        //
                        try
                        {
                            _transceiver.checkSendSize(_batchStream.getBuffer(), _instance.messageSizeMax());
                        }
                        catch(LocalException)
                        {
                            if(_batchRequestNum > 0)
                            {
                                flush = true;
                            }
                            else
                            {
                                throw;
                            }
                        }
                    }

                    if(flush)
                    {
                        //
                        // Temporarily save the last request.
                        //
                        int requestSize = _batchStream.size() - _batchMarker;
                        byte[] lastRequest = new byte[requestSize];
                        Buffer.BlockCopy(_batchStream.getBuffer().b.rawBytes(), _batchMarker, lastRequest, 0,
                                         requestSize);
                        _batchStream.resize(_batchMarker, false);

                        //
                        // Send the batch stream without the last request.
                        //
                        try
                        {
                            //
                            // Fill in the number of requests in the batch.
                            //
                            _batchStream.pos(IceInternal.Protocol.headerSize);
                            _batchStream.writeInt(_batchRequestNum);

                            OutgoingMessage message = new OutgoingMessage(_batchStream, _batchRequestCompress, true);
                            sendMessage(message);
                        }
                        catch(LocalException ex)
                        {
                            setState(StateClosed, ex);
                            Debug.Assert(_exception != null);
                            throw _exception;
                        }

                        //
                        // Reset the batch stream.
                        //
                        _batchStream = new IceInternal.BasicStream(_instance, Util.currentProtocolEncoding,
                                                                   _batchAutoFlush);
                        _batchRequestNum = 0;
                        _batchRequestCompress = false;
                        _batchMarker = 0;

                        //
                        // Check again if the last request doesn't exceed the maximum message size.
                        //
                        if(IceInternal.Protocol.requestBatchHdr.Length + lastRequest.Length >
                           _instance.messageSizeMax())
                        {
                            IceInternal.Ex.throwMemoryLimitException(
                                IceInternal.Protocol.requestBatchHdr.Length + lastRequest.Length,
                                _instance.messageSizeMax());
                        }

                        //
                        // Start a new batch with the last message that caused us to go over the limit.
                        //
                        _batchStream.writeBlob(IceInternal.Protocol.requestBatchHdr);
                        _batchStream.writeBlob(lastRequest);
                    }

                    //
                    // Increment the number of requests in the batch.
                    //
                    ++_batchRequestNum;

                    //
                    // We compress the whole batch if there is at least one compressed
                    // message.
                    //
                    if(compress)
                    {
                        _batchRequestCompress = true;
                    }

                    //
                    // Notify about the batch stream not being in use anymore.
                    //
                    Debug.Assert(_batchStreamInUse);
                    _batchStreamInUse = false;
                    _m.NotifyAll();
                }
                finally
                {
                    _m.Unlock();
                }
            }
            catch(LocalException)
            {
                abortBatchRequest();
                throw;
            }
        }
Пример #45
0
        private void initiateShutdown()
        {
            Debug.Assert(_state == StateClosing);
            Debug.Assert(_dispatchCount == 0);
            Debug.Assert(!_shutdownInitiated);

            _shutdownInitiated = true;

            if(!_endpoint.datagram())
            {
                //
                // Before we shut down, we send a close connection
                // message.
                //
                IceInternal.BasicStream os = new IceInternal.BasicStream(_instance, Util.currentProtocolEncoding);
                os.writeBlob(IceInternal.Protocol.magic);
                Ice.Util.currentProtocol.write__(os);
                Ice.Util.currentProtocolEncoding.write__(os);
                os.writeByte(IceInternal.Protocol.closeConnectionMsg);
                os.writeByte(_compressionSupported ? (byte)1 : (byte)0);
                os.writeInt(IceInternal.Protocol.headerSize); // Message size.

                if(sendMessage(new OutgoingMessage(os, false, false)))
                {
                    //
                    // Schedule the close timeout to wait for the peer to close the connection. If
                    // the message was queued for sending, sendNextMessage will schedule the timeout
                    // once all messages were sent.
                    //
                    scheduleTimeout(IceInternal.SocketOperation.Write, closeTimeout());
                }

                //
                // The CloseConnection message should be sufficient. Closing the write
                // end of the socket is probably an artifact of how things were done
                // in IIOP. In fact, shutting down the write end of the socket causes
                // problems on Windows by preventing the peer from using the socket.
                // For example, the peer is no longer able to continue writing a large
                // message after the socket is shutdown.
                //
                //_transceiver.shutdownWrite();
            }
        }
Пример #46
0
        public void finished(BasicStream istr)
        {
            _m.Lock();
            try
            {
                Debug.Assert(_handler.getReference().getMode() == Reference.Mode.ModeTwoway); // Only for twoways.

                Debug.Assert(_state <= StateInProgress);

                if(_remoteObserver != null)
                {
                    _remoteObserver.reply(istr.size() - Protocol.headerSize - 4);
                    _remoteObserver.detach();
                    _remoteObserver = null;
                }

                if(_is == null)
                {
                    _is = new IceInternal.BasicStream(_handler.getReference().getInstance(), 
                                                      Ice.Util.currentProtocolEncoding);
                }
                _is.swap(istr);
                byte replyStatus = _is.readByte();

                switch(replyStatus)
                {
                    case ReplyStatus.replyOK:
                    {
                        _state = StateOK; // The state must be set last, in case there is an exception.
                        break;
                    }

                    case ReplyStatus.replyUserException:
                    {
                        if(_observer != null)
                        {
                            _observer.userException();
                        }
                        _state = StateUserException; // The state must be set last, in case there is an exception.
                        break;
                    }

                    case ReplyStatus.replyObjectNotExist:
                    case ReplyStatus.replyFacetNotExist:
                    case ReplyStatus.replyOperationNotExist:
                    {
                        Ice.RequestFailedException ex = null;
                        switch(replyStatus)
                        {
                            case ReplyStatus.replyObjectNotExist:
                            {
                                ex = new Ice.ObjectNotExistException();
                                break;
                            }

                            case ReplyStatus.replyFacetNotExist:
                            {
                                ex = new Ice.FacetNotExistException();
                                break;
                            }

                            case ReplyStatus.replyOperationNotExist:
                            {
                                ex = new Ice.OperationNotExistException();
                                break;
                            }

                            default:
                            {
                                Debug.Assert(false);
                                break;
                            }
                        }

                        ex.id = new Ice.Identity();
                        ex.id.read__(_is);

                        //
                        // For compatibility with the old FacetPath.
                        //
                        string[] facetPath = _is.readStringSeq();
                        if(facetPath.Length > 0)
                        {
                            if(facetPath.Length > 1)
                            {
                                throw new Ice.MarshalException();
                            }
                            ex.facet = facetPath[0];
                        }
                        else
                        {
                            ex.facet = "";
                        }

                        ex.operation = _is.readString();
                        _exception = ex;

                        _state = StateLocalException; // The state must be set last, in case there is an exception.
                        break;
                    }

                    case ReplyStatus.replyUnknownException:
                    case ReplyStatus.replyUnknownLocalException:
                    case ReplyStatus.replyUnknownUserException:
                    {
                        Ice.UnknownException ex = null;
                        switch(replyStatus)
                        {
                            case ReplyStatus.replyUnknownException:
                            {
                                ex = new Ice.UnknownException();
                                break;
                            }

                            case ReplyStatus.replyUnknownLocalException:
                            {
                                ex = new Ice.UnknownLocalException();
                                break;
                            }

                            case ReplyStatus.replyUnknownUserException:
                            {
                                ex = new Ice.UnknownUserException();
                                break;
                            }

                            default:
                            {
                                Debug.Assert(false);
                                break;
                            }
                        }

                        ex.unknown = _is.readString();
                        _exception = ex;

                        _state = StateLocalException; // The state must be set last, in case there is an exception.
                        break;
                    }

                    default:
                    {
                        _exception = new Ice.UnknownReplyStatusException();
                        _state = StateLocalException;
                        break;
                    }
                }

                _m.Notify();
            }
            finally
            {
                _m.Unlock();
            }
        }
Пример #47
0
        public void abortBatchRequest()
        {
            lock(this)
            {
                _batchStream = new IceInternal.BasicStream(_instance, Util.currentProtocolEncoding);
                _batchRequestNum = 0;
                _batchRequestCompress = false;
                _batchMarker = 0;

                Debug.Assert(_batchStreamInUse);
                _batchStreamInUse = false;
                System.Threading.Monitor.PulseAll(this);
            }
        }