Beispiel #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (this._handle != null && !this._handle.IsInvalid)
     {
         this._handle.Dispose();
         this.io_debug = null;
     }
 }
Beispiel #2
0
        public void Swap(v4vConnection other)
        {
            v4vConnectionHandle _handleTemp = this._handle;

            Udbus.Serialization.UdbusDelegates.D_io_debug io_debugTemp = this.io_debug;

            this._handle  = other._handle;
            this.io_debug = other.io_debug;

            other._handle  = _handleTemp;
            other.io_debug = io_debugTemp;
        }
Beispiel #3
0
        static private Udbus.v4v.v4vConnection KeepTryingToConnectToV4V(Udbus.Serialization.UdbusDelegates.D_io_debug io_debug, System.Threading.ManualResetEvent stop, Udbus.Core.Logging.ILog log)
        {
            Udbus.v4v.v4vConnection connection = TryV4VConnection(io_debug, log);

            while (connection == null && stop.WaitOne(0) == false)
            {
                System.Threading.Thread.Sleep(ConnectionWaitMilliseconds);
                connection = TryV4VConnection(io_debug, log);
            } // Ends while failed to connect to V4V

            return(connection);
        }
Beispiel #4
0
        public v4vConnection Release()
        {
            v4vConnectionHandle _handleTemp = this._handle;

            Udbus.Serialization.UdbusDelegates.D_io_debug io_debugTemp = this.io_debug;

            this._handle  = null;
            this.io_debug = null;

            v4vConnection connectionRelease = new v4vConnection(_handleTemp, io_debugTemp);

            return(connectionRelease);
        }
Beispiel #5
0
        public v4vConnection(Udbus.Serialization.UdbusDelegates.D_io_debug io_debug)
        {
            this.io_debug = io_debug;

            // Form the v4v connection.
            v4vConnectionHandle handle = v4vConnectionFunctions.connect_v4v_socket(this.io_debug);

            if (handle == null || handle.IsInvalid)
            {
                throw Udbus.Serialization.Exceptions.TransportFailureException.Create(this, "Error calling connect_v4v_socket");
            }

            this._handle = handle;
        }
Beispiel #6
0
        public v4vConnection(Udbus.Serialization.UdbusDelegates.D_io_debug io_debug)
        {
            this.io_debug = io_debug;

            // Form the v4v connection.
            v4vConnectionHandle handle = v4vConnectionFunctions.connect_v4v_socket(this.io_debug);

            if (handle == null || handle.IsInvalid)
            {
                throw Udbus.Serialization.Exceptions.TransportFailureException.Create(this, "Error calling connect_v4v_socket");
            }

            this._handle = handle;
        }
Beispiel #7
0
        public static void GetV4vConnection(out Udbus.v4v.v4vConnection connection, out Udbus.Core.ServiceConnectionParams serviceConnectionParams,
                                            Udbus.Serialization.UdbusDelegates.D_io_debug io_debug, System.Threading.ManualResetEvent stop,
                                            Udbus.Core.Logging.ILog log)
        {
            connection = null;
            serviceConnectionParams = null;

            while (serviceConnectionParams == null)
            {
                using (Udbus.v4v.v4vConnection connectionTemp = KeepTryingToConnectToV4V(io_debug, stop, log))
                {
                    if (connectionTemp != null) // If got v4v connection
                    {
                        Udbus.v4v.v4vConnection connectionTemp2 = connectionTemp.Release();
                        try
                        {
                            Udbus.Core.ServiceConnectionParams serviceConnectionParamsTemp = TryServiceConnectionParams(connectionTemp2, log);

                            if (serviceConnectionParamsTemp == null) // If failed to create service connection
                            {
                                connectionTemp.Swap(connectionTemp2);
                            }    // Ends if failed to create service connection
                            else // Else created service connection
                            {
                                serviceConnectionParams = serviceConnectionParamsTemp;
                                connection = connectionTemp2;
                            } // Ends else created service connection
                        }
                        catch (Exception /*ex*/)
                        {
                            connectionTemp.Swap(connectionTemp2);
                            throw;
                        }
                    } // Ends if got v4v connection
                }     // Ends using v4vConnection

                if (serviceConnectionParams == null) // If failed to create connection
                {
                    // Wait a while.
                    System.Threading.Thread.Sleep(ConnectionWaitMilliseconds);
                } // Ends if failed to create connection
            }     // Ends while trying to setup service connection
        }
Beispiel #8
0
        static private Udbus.v4v.v4vConnection TryV4VConnection(Udbus.Serialization.UdbusDelegates.D_io_debug io_debug, Udbus.Core.Logging.ILog log)
        {
            Udbus.v4v.v4vConnection result = null;

            try
            {
                Udbus.v4v.v4vConnection create = new Udbus.v4v.v4vConnection(io_debug);
                result = create;
            }
            catch (Udbus.Serialization.Exceptions.TransportFailureException transportEx)
            {
                log.Exception("Failed to create V4V transport. {0}", transportEx);
            }
            catch (Exception ex)
            {
                log.Exception("Error creating V4V transport. {0}", ex);
            }

            return(result);
        }
Beispiel #9
0
 private Udbus.v4v.v4vConnection KeepTryingToConnectToV4V(Udbus.Serialization.UdbusDelegates.D_io_debug io_debug, System.Threading.ManualResetEvent stop)
 {
     return(KeepTryingToConnectToV4V(io_debug, stop, this.log));
 }
Beispiel #10
0
        public v4vConnection Release()
        {
            v4vConnectionHandle _handleTemp = this._handle;
            Udbus.Serialization.UdbusDelegates.D_io_debug io_debugTemp = this.io_debug;

            this._handle = null;
            this.io_debug = null;

            v4vConnection connectionRelease = new v4vConnection(_handleTemp, io_debugTemp);
            return connectionRelease;
        }
Beispiel #11
0
 private v4vConnection(v4vConnectionHandle _handle, Udbus.Serialization.UdbusDelegates.D_io_debug io_debug)
 {
     this._handle = _handle;
     this.io_debug = io_debug;
 }
Beispiel #12
0
 protected virtual void Dispose(bool disposing)
 {
     if (this._handle != null && !this._handle.IsInvalid)
     {
         this._handle.Dispose();
         this.io_debug = null;
     }
 }
Beispiel #13
0
 private Udbus.v4v.v4vConnection TryV4VConnection(Udbus.Serialization.UdbusDelegates.D_io_debug io_debug)
 {
     return(TryV4VConnection(io_debug, this.log));
 }
Beispiel #14
0
 // _UDBUS_V4V_API TransportData * _UDBUS_V4V_CALLCONV connect_v4v_socket(void (_UDBUS_V4V_CALLCONV *io_debug)(void *logpriv, const char *buf)=NULL);
 //internal extern static IntPtr connect_v4v_socket(IntPtr io_debug);
 internal extern static v4vConnectionHandle connect_v4v_socket(Udbus.Serialization.UdbusDelegates.D_io_debug io_debug);
Beispiel #15
0
        internal static com.citrix.xenclient.xenmgr.diag.diagService CreateDbusDiag(out Udbus.Core.ServiceConnectionParams serviceConnectionParams,
                                                                                    Udbus.Core.Logging.ILog log, Udbus.Serialization.UdbusDelegates.D_io_debug io_debug)
        {
            // Create a V4V connection.
            Udbus.v4v.v4vConnection           connection;
            System.Threading.ManualResetEvent stop = new System.Threading.ManualResetEvent(false);
            DbusHosts.GetV4vConnection(out connection, out serviceConnectionParams,
                                       io_debug, stop,
                                       log
                                       );

            // Use dbus interface to xenmgr.diag.
            Udbus.Serialization.DbusConnectionParameters dbusConnectionParameters = com.citrix.xenclient.xenmgr.diag.diagService.DefaultConnectionParameters;
            dbusConnectionParameters.Destination = "com.citrix.xenclient.xenmgr";
            com.citrix.xenclient.xenmgr.diag.diagService diag = com.citrix.xenclient.xenmgr.diag.diagService.Create(serviceConnectionParams, dbusConnectionParameters);

            return(diag);
        }
Beispiel #16
0
 private v4vConnection(v4vConnectionHandle _handle, Udbus.Serialization.UdbusDelegates.D_io_debug io_debug)
 {
     this._handle  = _handle;
     this.io_debug = io_debug;
 }
Beispiel #17
0
        public void Swap(v4vConnection other)
        {
            v4vConnectionHandle _handleTemp = this._handle;
            Udbus.Serialization.UdbusDelegates.D_io_debug io_debugTemp = this.io_debug;

            this._handle = other._handle;
            this.io_debug = other.io_debug;

            other._handle = _handleTemp;
            other.io_debug = io_debugTemp;
        }