Exemple #1
0
        private void OnSocketError(string message, SocketError se)
        {
            BitSwarmEvent bitSwarmEvent = new BitSwarmEvent(BitSwarmEvent.IO_ERROR);

            bitSwarmEvent.Params            = new Hashtable();
            bitSwarmEvent.Params["message"] = message + " ==> " + se;
            DispatchEvent(bitSwarmEvent);
        }
        private void OnBBConnect(BaseEvent e)
        {
            bbConnected = true;
            BitSwarmEvent bitSwarmEvent = new BitSwarmEvent(BitSwarmEvent.CONNECT);

            bitSwarmEvent.Params                   = new Hashtable();
            bitSwarmEvent.Params["success"]        = true;
            bitSwarmEvent.Params["isReconnection"] = false;
            DispatchEvent(bitSwarmEvent);
        }
        private void OnSocketConnect()
        {
            BitSwarmEvent bitSwarmEvent = new BitSwarmEvent(BitSwarmEvent.CONNECT);
            Hashtable     hashtable     = new Hashtable();

            hashtable["success"]        = true;
            hashtable["isReconnection"] = attemptingReconnection;
            bitSwarmEvent.Params        = hashtable;
            DispatchEvent(bitSwarmEvent);
        }
        private void OnBBError(BaseEvent e)
        {
            BBEvent bBEvent = e as BBEvent;

            log.Error("## BlueBox Error: " + (string)bBEvent.Params["message"]);
            BitSwarmEvent bitSwarmEvent = new BitSwarmEvent(BitSwarmEvent.IO_ERROR);

            bitSwarmEvent.Params            = new Hashtable();
            bitSwarmEvent.Params["message"] = bBEvent.Params["message"];
            DispatchEvent(bitSwarmEvent);
        }
        private void OnSocketError(string message, SocketError se)
        {
            manualDisconnection = false;
            if (attemptingReconnection)
            {
                Reconnect();
                return;
            }
            BitSwarmEvent bitSwarmEvent = new BitSwarmEvent(BitSwarmEvent.IO_ERROR);

            bitSwarmEvent.Params            = new Hashtable();
            bitSwarmEvent.Params["message"] = message + " ==> " + se;
            DispatchEvent(bitSwarmEvent);
        }
 private void OnSocketData(byte[] data)
 {
     try
     {
         ByteArray buffer = new ByteArray(data);
         ioHandler.OnDataRead(buffer);
     }
     catch (Exception ex)
     {
         log.Error("## SocketDataError: " + ex.Message);
         BitSwarmEvent bitSwarmEvent = new BitSwarmEvent(BitSwarmEvent.DATA_ERROR);
         Hashtable     hashtable     = new Hashtable();
         hashtable["message"] = ex.ToString();
         bitSwarmEvent.Params = hashtable;
         DispatchEvent(bitSwarmEvent);
     }
 }
 private void DispatchEvent(BitSwarmEvent evt)
 {
     dispatcher.DispatchEvent(evt);
 }