Inheritance: IDisposable
 //public XmlRpcValue stickaroundyouwench = null;
 public PendingConnection(XmlRpcClient client, Subscription s, string uri, XmlRpcValue chk)
 {
     this.client = client;
     this.chk = chk;
     parent = s;
     RemoteUri = uri;
 }
Beispiel #2
0
 public void AddSource(XmlRpcClient source, int eventMask)
 {
     addsource(instance, source.instance, (uint) eventMask);
 }
Beispiel #3
0
 public void SetSourceEvents(XmlRpcClient source, int eventMask)
 {
     setsourceevents(instance, source.instance, (uint)eventMask);
 }
Beispiel #4
0
 public void RemoveSource(XmlRpcClient source)
 {
     source.SegFault();
     removesource(instance, source.instance);
 }
Beispiel #5
0
 public void AddSource(XmlRpcClient source, int eventMask)
 {
     addsource(instance, source.instance, (uint)eventMask);
 }
Beispiel #6
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     lock (busyMutex)
     {
         if (refs != 0)
             throw new Exception("XmlRpcClient disposed while in use!");
     }
     if (client != null)
     {
         client.Dispose();
         client = null;
     }
 }
Beispiel #7
0
 private CachedXmlRpcClient(XmlRpcClient c)
 {
     client = c;
 }
Beispiel #8
0
 public XmlRpcClient getXMLRPCClient(string host, int port, string uri)
 {
     XmlRpcClient c = null;
     lock (clients_mutex)
     {
         List<CachedXmlRpcClient> zombies = new List<CachedXmlRpcClient>();
         foreach (CachedXmlRpcClient client in clients)
         {
             if (!client.in_use)
             {
                 if (client.client.Host == host && client.client.Port == port && client.client.Uri == uri)
                 {
                     c = client.client;
                     client.in_use = true;
                     client.last_use_time = DateTime.Now;
                     break;
                 }
                 else if (DateTime.Now.Subtract(client.last_use_time).TotalSeconds > 30 ||
                          !client.client.IsConnected)
                 {
                     client.client.Shutdown();
                     zombies.Add(client);
                 }
             }
         }
         clients = clients.Except(zombies).ToList();
     }
     if (c == null)
     {
         c = new XmlRpcClient(host, port, uri);
         clients.Add(new CachedXmlRpcClient(c) {in_use = true, last_use_time = DateTime.Now});
     }
     return c;
 }
Beispiel #9
0
 private CachedXmlRpcClient(XmlRpcClient c)
 {
     lock (client_lock)
     {
         client = c;
         client.Disposed += () =>
                                {
                                    client = null;
                                };
     }
 }
Beispiel #10
0
 /// <summary>
 ///     Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     lock (busyMutex)
     	if (refs != 0)
         	EDB.WriteLine("warning: XmlRpcClient disposed with "+refs+" refs held");
     lock (client_lock)
     {
         if (client != null)
         {
             client.Dispose();
             client = null;
         }
     }
 }
 //public XmlRpcValue stickaroundyouwench = null;
 public PendingConnection(XmlRpcClient client, string uri)
 {
     this.client = client;
     RemoteUri = uri;
 }
Beispiel #12
0
 public CachedXmlRpcClient(XmlRpcClient c)
 {
     client = c;
 }
Beispiel #13
0
 public void releaseXMLRPCClient(XmlRpcClient client)
 {
     lock (clients_mutex)
     {
         foreach (CachedXmlRpcClient c in clients)
         {
             if (client == c.client)
             {
                 c.in_use = false;
                 break;
             }
         }
     }
 }
Beispiel #14
0
 public void RemoveSource(XmlRpcClient source)
 {
     source.SegFault();
     removesource(instance, source.instance);
 }
 public void Dispose()
 {
     chk = null; //.Dispose();
     client.Dispose();
     client = null;
 }
Beispiel #16
0
 public void SetSourceEvents(XmlRpcClient source, int eventMask)
 {
     setsourceevents(instance, source.instance, (uint) eventMask);
 }
Beispiel #17
0
 public XmlRpcClient getXMLRPCClient(string host, int port, string uri)
 {
     XmlRpcClient c = null;
     lock (clients_mutex)
     {
         List<CachedXmlRpcClient> zombies = new List<CachedXmlRpcClient>();
         foreach (CachedXmlRpcClient client in clients)
         {
             if (!client.in_use)
             {
                 if (DateTime.Now.Subtract(client.last_use_time).TotalSeconds > 30 ||
                     !client.client.IsConnected)
                 {
                     client.client.Shutdown();
                     zombies.Add(client);
                 }
                 else if (client.client.CheckIdentity(host, port, uri))
                 {
                     c = client.client;
                     client.in_use = true;
                     client.last_use_time = DateTime.Now;
                     break;
                 }
             }
         }
         foreach (CachedXmlRpcClient C in zombies)
         {
             clients.Remove(C);
             C.client.Dispose();
         }
         if (c == null)
         {
             c = new XmlRpcClient(host, port, uri);
             clients.Add(new CachedXmlRpcClient(c) {in_use = true, last_use_time = DateTime.Now});
         }
     }
     return c;
 }