Esempio n. 1
0
 private void ThreadExec()
 {
     try
     {
         if (!this._Connect())
         {
             this.KillSelf("Unable to connect to remote");
             return;
         }
         // why is this??
         if (!IRCNetwork.IsConnected)
             IRCNetwork.IsConnected = true;
         while (!streamReader.EndOfStream && IsConnected)
         {
             string text;
             if (Backlog.Count > 0)
             {
                 lock (Backlog)
                 {
                     text = Backlog[0];
                     Backlog.RemoveAt(0);
                 }
             } else
             {
                 text = streamReader.ReadLine();
             }
             if (Configuration.IRC.UsingBouncer && text[0] == 'C' && text.StartsWith("CONTROL: "))
             {
                 if (text == "CONTROL: DC")
                 {
                     Syslog.Log("CACHE: Lost connection to remote on " + this.IRCNetwork.Nickname);
                     this.ChannelsJoined = false;
                     this.IsWorking = false;
                     this.KillSelf("Lost connection to remote");
                     return;
                 }
             }
             text = this.RawTraffic(text);
             this.TrafficLog(text, true);
             libirc.ProcessorIRC processor = new libirc.ProcessorIRC(IRCNetwork, text, ref LastPing);
             processor.ProfiledResult();
             LastPing = processor.pong;
         }
     }catch (ThreadAbortException)
     {
         KillSelf("Thread aborted");
     }catch (System.Net.Sockets.SocketException ex)
     {
         this.KillSelf(ex.Message);
     }catch (System.IO.IOException ex)
     {
        this.KillSelf(ex.Message);
     } catch (Exception fail)
     {
         Core.HandleException(fail);
         this.KillSelf(fail.Message);
     }
 }
 private void ThreadExec()
 {
     try
     {
         if (!this._Connect())
         {
             this.KillSelf("Unable to connect to remote");
             return;
         }
         // why is this??
         if (!IRCNetwork.IsConnected)
         {
             IRCNetwork.IsConnected = true;
         }
         while (!streamReader.EndOfStream && IsConnected)
         {
             string text;
             if (Backlog.Count > 0)
             {
                 lock (Backlog)
                 {
                     text = Backlog[0];
                     Backlog.RemoveAt(0);
                 }
             }
             else
             {
                 text = streamReader.ReadLine();
             }
             if (Configuration.IRC.UsingBouncer && text[0] == 'C' && text.StartsWith("CONTROL: "))
             {
                 if (text == "CONTROL: DC")
                 {
                     Syslog.Log("CACHE: Lost connection to remote on " + this.IRCNetwork.Nickname);
                     this.ChannelsJoined = false;
                     this.IsWorking      = false;
                     this.KillSelf("Lost connection to remote");
                     return;
                 }
             }
             text = this.RawTraffic(text);
             this.TrafficLog(text, true);
             libirc.ProcessorIRC processor = new libirc.ProcessorIRC(IRCNetwork, text, ref LastPing);
             processor.ProfiledResult();
             LastPing = processor.pong;
         }
     }catch (ThreadAbortException)
     {
         KillSelf("Thread aborted");
     }catch (System.Net.Sockets.SocketException ex)
     {
         this.KillSelf(ex.Message);
     }catch (System.IO.IOException ex)
     {
         this.KillSelf(ex.Message);
     } catch (Exception fail)
     {
         Core.HandleException(fail);
         this.KillSelf(fail.Message);
     }
 }