From ac80b6539f81018122f211c26805d4a9f9da32ff Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 30 May 2009 03:18:09 +0000 Subject: * May partially implement a C# IRCd & IRCClientStack. --- .../InternetRelayClientView/Server/IRCServer.cs | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs new file mode 100644 index 0000000..4b39b92 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading; + +namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server +{ + /// + /// Adam's completely hacked up not-probably-compliant RFC1459 server class. + /// + class IRCServer + { + private TcpListener m_listener; + private bool m_running = true; + + public IRCServer(IPAddress listener, int port) + { + m_listener = new TcpListener(listener, port); + + m_listener.Start(50); + + Thread thread = new Thread(ListenLoop); + thread.Start(); + } + + public void Stop() + { + m_running = false; + m_listener.Stop(); + } + + private void ListenLoop() + { + while(m_running) + { + AcceptClient(m_listener.AcceptTcpClient()); + } + } + + private void AcceptClient(TcpClient client) + { + + } + } +} -- cgit v1.1 From 29bc2962adc2b0a297bb2c2eb70b5261d7cafc70 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 30 May 2009 03:53:04 +0000 Subject: * More IRCClientView fiddling. Now implements IClientAPI & IClientCore. --- .../Agent/InternetRelayClientView/Server/IRCServer.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index 4b39b92..23c213f 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -2,20 +2,30 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; +using System.Reflection; using System.Text; using System.Threading; +using log4net; +using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server { + public delegate void OnNewIRCUserDelegate(IRCClientView user); + /// /// Adam's completely hacked up not-probably-compliant RFC1459 server class. /// class IRCServer { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public event OnNewIRCUserDelegate OnNewIRCClient; + private TcpListener m_listener; + private Scene m_baseScene; private bool m_running = true; - public IRCServer(IPAddress listener, int port) + public IRCServer(IPAddress listener, int port, Scene baseScene) { m_listener = new TcpListener(listener, port); @@ -23,6 +33,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server Thread thread = new Thread(ListenLoop); thread.Start(); + m_baseScene = baseScene; } public void Stop() @@ -41,7 +52,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server private void AcceptClient(TcpClient client) { - + IRCClientView cv = new IRCClientView(client, m_baseScene); + + if (OnNewIRCClient != null) + OnNewIRCClient(cv); } } } -- cgit v1.1 From 1bb98a1eb0f15da904657bc625b27751314af8dc Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 30 May 2009 04:07:58 +0000 Subject: * More Tweaks --- .../OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index 23c213f..b8f5afa 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -21,8 +21,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event OnNewIRCUserDelegate OnNewIRCClient; - private TcpListener m_listener; - private Scene m_baseScene; + private readonly TcpListener m_listener; + private readonly Scene m_baseScene; private bool m_running = true; public IRCServer(IPAddress listener, int port, Scene baseScene) -- cgit v1.1 From db2c4ab94cc40bf16910806fd4fe0d9a2b7cbd8f Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 31 May 2009 16:26:18 +0000 Subject: Update svn properties. --- .../InternetRelayClientView/Server/IRCServer.cs | 122 ++++++++++----------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index b8f5afa..612ac48 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -1,61 +1,61 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; -using System.Reflection; -using System.Text; -using System.Threading; -using log4net; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server -{ - public delegate void OnNewIRCUserDelegate(IRCClientView user); - - /// - /// Adam's completely hacked up not-probably-compliant RFC1459 server class. - /// - class IRCServer - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public event OnNewIRCUserDelegate OnNewIRCClient; - - private readonly TcpListener m_listener; - private readonly Scene m_baseScene; - private bool m_running = true; - - public IRCServer(IPAddress listener, int port, Scene baseScene) - { - m_listener = new TcpListener(listener, port); - - m_listener.Start(50); - - Thread thread = new Thread(ListenLoop); - thread.Start(); - m_baseScene = baseScene; - } - - public void Stop() - { - m_running = false; - m_listener.Stop(); - } - - private void ListenLoop() - { - while(m_running) - { - AcceptClient(m_listener.AcceptTcpClient()); - } - } - - private void AcceptClient(TcpClient client) - { - IRCClientView cv = new IRCClientView(client, m_baseScene); - - if (OnNewIRCClient != null) - OnNewIRCClient(cv); - } - } -} +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Reflection; +using System.Text; +using System.Threading; +using log4net; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server +{ + public delegate void OnNewIRCUserDelegate(IRCClientView user); + + /// + /// Adam's completely hacked up not-probably-compliant RFC1459 server class. + /// + class IRCServer + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public event OnNewIRCUserDelegate OnNewIRCClient; + + private readonly TcpListener m_listener; + private readonly Scene m_baseScene; + private bool m_running = true; + + public IRCServer(IPAddress listener, int port, Scene baseScene) + { + m_listener = new TcpListener(listener, port); + + m_listener.Start(50); + + Thread thread = new Thread(ListenLoop); + thread.Start(); + m_baseScene = baseScene; + } + + public void Stop() + { + m_running = false; + m_listener.Stop(); + } + + private void ListenLoop() + { + while(m_running) + { + AcceptClient(m_listener.AcceptTcpClient()); + } + } + + private void AcceptClient(TcpClient client) + { + IRCClientView cv = new IRCClientView(client, m_baseScene); + + if (OnNewIRCClient != null) + OnNewIRCClient(cv); + } + } +} -- cgit v1.1 From 35b450d41d2695aa6a82a6d8e6bda5e327f431e1 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 31 May 2009 18:35:00 +0000 Subject: Add copyright headers, formatting cleanup, ignore some generated files. --- .../InternetRelayClientView/Server/IRCServer.cs | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index 612ac48..43a28a2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using System.Net; using System.Net.Sockets; @@ -44,7 +71,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server private void ListenLoop() { - while(m_running) + while (m_running) { AcceptClient(m_listener.AcceptTcpClient()); } -- cgit v1.1 From c6cef4bad5fe939b822687f521907c11c05a2bb3 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 4 Jun 2009 03:58:04 +0000 Subject: Comment out unused variables / private fields to avoid compiler warnings. --- .../OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index 43a28a2..91ce9f1 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -44,8 +44,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server /// class IRCServer { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public event OnNewIRCUserDelegate OnNewIRCClient; private readonly TcpListener m_listener; -- cgit v1.1 From b2ed348aa2746fbf034b713d006e40366c479d5a Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 22 Oct 2009 12:33:23 -0700 Subject: Implemented a Watchdog class. Do not manually create Thread objects anymore, use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated --- .../Agent/InternetRelayClientView/Server/IRCServer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index 91ce9f1..eb39026 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -33,6 +33,7 @@ using System.Reflection; using System.Text; using System.Threading; using log4net; +using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server @@ -56,8 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_listener.Start(50); - Thread thread = new Thread(ListenLoop); - thread.Start(); + Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); m_baseScene = baseScene; } @@ -72,7 +72,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server while (m_running) { AcceptClient(m_listener.AcceptTcpClient()); + Watchdog.UpdateThread(); } + + Watchdog.RemoveThread(); } private void AcceptClient(TcpClient client) -- cgit v1.1 From f67f37074f3f7e0602b66aa66a044dd9fd107f6a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:02:33 +0000 Subject: Stop spurious scene loop startup timeout alarms for scenes with many prims. On the first frame, all startup scene objects are added to the physics scene. This can cause a considerable delay, so we don't start raising the alarm on scene loop timeouts until the second frame. This commit also slightly changes the behaviour of timeout reporting. Previously, a report was made for the very first timed out thread, ignoring all others until the next watchdog check. Instead, we now report every timed out thread, though we still only do this once no matter how long the timeout. --- .../OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index eb39026..a7c5020 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_listener.Start(50); - Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); + Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); m_baseScene = baseScene; } -- cgit v1.1 From 5aec0ff207e9427b8756471eb003fd68859f67b1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Jul 2012 23:27:00 +0100 Subject: Move Watchdog and MemoryWatchdog classes into OpenSim.Framework.Monitoring with other monitoring code from OpenSim.Framework --- .../OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index a7c5020..9d27386 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -34,6 +34,7 @@ using System.Text; using System.Threading; using log4net; using OpenSim.Framework; +using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server -- cgit v1.1 From 86367d7219b3bd52f63045b2b17bcbde328844ed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 25 Nov 2014 23:56:32 +0000 Subject: refactor: Move methods to start a monitored thread, start work in its own thread and run work in the jobengine from Watchdog to a WorkManager class. This is to achieve a clean separation of concerns - the watchdog is an inappropriate place for work management. Also adds a WorkManager.RunInThreadPool() class which feeds through to Util.FireAndForget. Also switches around the name and obj arguments to the new RunInThread() and RunJob() methods so that the callback obj comes after the callback as seen in the SDK and elsewhere --- .../OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index 9d27386..a1682d2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_listener.Start(50); - Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); + WorkManager.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); m_baseScene = baseScene; } -- cgit v1.1