Ejemplo n.º 1
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting
        /// unmanaged resources.
        /// </summary>
        public override void Dispose()
        {
            this.disposed         = true;
            this.xmppClient       = null;
            this.bindingInterface = null;

            if (this.httpClients != null)
            {
                foreach (HttpClient Client in this.httpClients)
                {
                    if (Client != null)
                    {
                        Client.Dispose();
                    }
                }

                this.httpClients = null;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Instantiates a new alternative connections.
 /// </summary>
 /// <param name="URI">URI defining endpoint.</param>
 /// <param name="Client">XMPP Client</param>
 /// <param name="BindingInterface">Inteface to internal properties of the <see cref="XmppClient"/>.</param>
 /// <returns>Instantiated binding.</returns>
 public override IAlternativeTransport Instantiate(Uri URI, XmppClient Client, XmppBindingInterface BindingInterface)
 {
     return(new WebSocketBinding()
     {
         bindingInterface = BindingInterface,
         url = URI,
         xmppClient = Client,
         inputBuffer = new ArraySegment <byte>(new byte[65536])
     });
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Instantiates a new alternative connections.
        /// </summary>
        /// <param name="URI">URI defining endpoint.</param>
        /// <param name="Client">XMPP Client</param>
        /// <param name="BindingInterface">Inteface to internal properties of the <see cref="XmppClient"/>.</param>
        /// <returns>Instantiated binding.</returns>
        public override IAlternativeTransport Instantiate(Uri URI, XmppClient Client, XmppBindingInterface BindingInterface)
        {
            HttpBinding Result = new HttpBinding()
            {
                bindingInterface = BindingInterface,
                url         = URI,
                xmppClient  = Client,
                active      = new bool[1],
                httpClients = new HttpClient[1],
                rid         = BitConverter.ToUInt32(XmppClient.GetRandomBytes(4), 0) + 1
            };

            Result.httpClients = new HttpClient[1];

            return(Result);
        }