Annotation of /branches/os-udp/ModularRex/RexNetwork/RexUDPServer.cs
Parent Directory
|
Revision Log
Revision 230 - (view) (download)
| 1 : | afrisby | 5 | using OpenSim.Region.ClientStack; |
| 2 : | using OpenSim.Region.ClientStack.LindenUDP; | ||
| 3 : | mikkopa | 213 | using System.Net; |
| 4 : | using Nini.Config; | ||
| 5 : | using OpenSim.Framework; | ||
| 6 : | using log4net; | ||
| 7 : | using System.Reflection; | ||
| 8 : | mikkopa | 228 | using OpenMetaverse; |
| 9 : | using OpenMetaverse.Packets; | ||
| 10 : | using System.Threading; | ||
| 11 : | using System; | ||
| 12 : | afrisby | 2 | |
| 13 : | namespace ModularRex.RexNetwork | ||
| 14 : | { | ||
| 15 : | afrisby | 11 | /// <summary> |
| 16 : | /// Extends the standard OpenSim UDP Server Class | ||
| 17 : | /// With the only difference being that the packet | ||
| 18 : | /// server spawns RexClientView instances instead | ||
| 19 : | /// of LLClientView's. | ||
| 20 : | /// </summary> | ||
| 21 : | afrisby | 2 | public class RexUDPServer : LLUDPServer |
| 22 : | { | ||
| 23 : | mikkopa | 213 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
| 24 : | mikkopa | 228 | private string m_clientToSpawn; |
| 25 : | mikkopa | 213 | |
| 26 : | public RexUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, | ||
| 27 : | mikkopa | 228 | AgentCircuitManager authenticateClass) : base (_listenIP, ref port, proxyPortOffset, allow_alternate_port, configSource, authenticateClass) |
| 28 : | mikkopa | 213 | { |
| 29 : | mikkopa | 228 | Init(configSource); |
| 30 : | mikkopa | 213 | } |
| 31 : | |||
| 32 : | mikkopa | 228 | protected void Init(IConfigSource configSource) |
| 33 : | afrisby | 2 | { |
| 34 : | mikkopa | 228 | m_clientToSpawn = "default"; |
| 35 : | IConfig rexConfig = configSource.Configs["realXtend"]; | ||
| 36 : | if (rexConfig != null) | ||
| 37 : | { | ||
| 38 : | if (rexConfig.Contains("ClientView")) | ||
| 39 : | { | ||
| 40 : | m_clientToSpawn = rexConfig.Get("ClientView", "default"); | ||
| 41 : | } | ||
| 42 : | } | ||
| 43 : | mikkopa | 213 | |
| 44 : | mikkopa | 228 | //CreatePacketServer(userSettings, clientToSpawn); |
| 45 : | mikkopa | 213 | } |
| 46 : | |||
| 47 : | mikkopa | 228 | protected override void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) |
| 48 : | mikkopa | 213 | { |
| 49 : | mikkopa | 228 | // Create the LLUDPClient |
| 50 : | mikkopa | 230 | LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint); |
| 51 : | mikkopa | 213 | |
| 52 : | mikkopa | 230 | if (!m_scene.ClientManager.ContainsKey(agentID)) |
| 53 : | { | ||
| 54 : | // Create the LLClientView | ||
| 55 : | LLClientView client = CreateNewClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); | ||
| 56 : | client.OnLogout += LogoutHandler; | ||
| 57 : | mikkopa | 213 | |
| 58 : | mikkopa | 230 | // Start the IClientAPI |
| 59 : | client.Start(); | ||
| 60 : | } | ||
| 61 : | else | ||
| 62 : | { | ||
| 63 : | m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}", | ||
| 64 : | udpClient.AgentID, remoteEndPoint, circuitCode); | ||
| 65 : | } | ||
| 66 : | mikkopa | 228 | } |
| 67 : | |||
| 68 : | mikkopa | 230 | protected LLClientView CreateNewClientView(EndPoint remoteEP, IScene scene, LLUDPServer udpServer, LLUDPClient udpClient, |
| 69 : | mikkopa | 228 | AuthenticateResponse sessionInfo, OpenMetaverse.UUID agentId, OpenMetaverse.UUID sessionId, uint circuitCode) |
| 70 : | { | ||
| 71 : | switch (m_clientToSpawn.ToLower()) | ||
| 72 : | mikkopa | 213 | { |
| 73 : | mikkopa | 228 | case "ng": |
| 74 : | case "naali": | ||
| 75 : | return new NaaliClientView(remoteEP, scene, udpServer, udpClient, | ||
| 76 : | sessionInfo, agentId, sessionId, circuitCode); | ||
| 77 : | case "0.4": | ||
| 78 : | case "0.40": | ||
| 79 : | case "0.41": | ||
| 80 : | case "legacy": | ||
| 81 : | return new RexClientViewLegacy(remoteEP, scene, udpServer, udpClient, | ||
| 82 : | sessionInfo, agentId, sessionId, circuitCode); | ||
| 83 : | case "default": | ||
| 84 : | case "compatible": | ||
| 85 : | default: | ||
| 86 : | return new RexClientViewCompatible(remoteEP, scene, udpServer, udpClient, | ||
| 87 : | sessionInfo, agentId, sessionId, circuitCode); | ||
| 88 : | mikkopa | 213 | } |
| 89 : | } | ||
| 90 : | afrisby | 2 | } |
| 91 : | } |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

