Beispiel #1
0
        private bool SafeOpenConnection()
        {
            SafeCloseConnection();

            lock (SyncRoot)
            {
                if (!Faulted)
                {
                    m_client = new VertexServiceClient(m_backendBinding, new EndpointAddress(m_endpointAddress));
                    m_connectionAttempts++;
                    return true;
                }
                return false;
            }
        }
Beispiel #2
0
        private void SafeCloseConnection()
        {
            VertexServiceClient client = null;
            lock (SyncRoot)
            {
                if (m_client == null)
                {
                    return;
                }

                client = m_client;
                m_client = null;
            }

            try
            {
                client.Close();
            }
            catch
            {
                try
                {
                    client.Abort();
                }
                catch
                {
                }
            }
        }