* Commit 2/3 - Please dont attempt to update to this revision until all 3 are in.

0.6.0-stable
Adam Frisby 2008-05-02 16:41:08 +00:00
parent c6236b5cf3
commit 29b8c84cea
14 changed files with 6339 additions and 6367 deletions

View File

@ -40,6 +40,7 @@ using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack; using OpenSim.Region.ClientStack;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Communications.Local; using OpenSim.Region.Communications.Local;
using OpenSim.Region.Communications.OGS1; using OpenSim.Region.Communications.OGS1;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
@ -70,7 +71,7 @@ namespace OpenSim
protected string m_storageDll; protected string m_storageDll;
protected List<UDPServer> m_udpServers = new List<UDPServer>(); protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
protected List<RegionInfo> m_regionData = new List<RegionInfo>(); protected List<RegionInfo> m_regionData = new List<RegionInfo>();
protected bool m_physicalPrim; protected bool m_physicalPrim;
@ -105,9 +106,9 @@ namespace OpenSim
get { return m_httpServer; } get { return m_httpServer; }
} }
public List<UDPServer> UdpServers public List<IClientNetworkServer> UdpServers
{ {
get { return m_udpServers; } get { return m_clientServers; }
} }
public List<RegionInfo> RegionData public List<RegionInfo> RegionData
@ -327,7 +328,7 @@ namespace OpenSim
// We are done with startup // We are done with startup
m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}", m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}",
m_udpServers.Count.ToString(), m_udpServers.Count > 1 ? "s" : ""); m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : "");
WorldHasComeToAnEnd.WaitOne(); WorldHasComeToAnEnd.WaitOne();
m_log.Info("[OPENSIM MAIN]: Shutdown complete, goodbye."); m_log.Info("[OPENSIM MAIN]: Shutdown complete, goodbye.");
Environment.Exit(0); Environment.Exit(0);
@ -452,7 +453,7 @@ namespace OpenSim
/// <param name="regionInfo"></param> /// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param> /// <param name="portadd_flag"></param>
/// <returns></returns> /// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
{ {
return CreateRegion(regionInfo, portadd_flag, false); return CreateRegion(regionInfo, portadd_flag, false);
} }
@ -463,7 +464,7 @@ namespace OpenSim
/// <param name="regionInfo"></param> /// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param> /// <param name="portadd_flag"></param>
/// <returns></returns> /// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo) public LLUDPServer CreateRegion(RegionInfo regionInfo)
{ {
return CreateRegion(regionInfo, false, true); return CreateRegion(regionInfo, false, true);
} }
@ -475,7 +476,7 @@ namespace OpenSim
/// <param name="portadd_flag"></param> /// <param name="portadd_flag"></param>
/// <param name="do_post_init"></param> /// <param name="do_post_init"></param>
/// <returns></returns> /// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init) public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init)
{ {
int port = regionInfo.InternalEndPoint.Port; int port = regionInfo.InternalEndPoint.Port;
@ -495,7 +496,7 @@ namespace OpenSim
Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
} }
UDPServer udpServer; LLUDPServer udpServer;
Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions); Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions);
m_log.Info("[MODULES]: Loading Region's modules"); m_log.Info("[MODULES]: Loading Region's modules");
@ -548,7 +549,7 @@ namespace OpenSim
m_sceneManager.Add(scene); m_sceneManager.Add(scene);
m_udpServers.Add(udpServer); m_clientServers.Add(udpServer);
m_regionData.Add(regionInfo); m_regionData.Add(regionInfo);
udpServer.ServerListener(); udpServer.ServerListener();
@ -586,9 +587,9 @@ namespace OpenSim
bool foundUDPServer = false; bool foundUDPServer = false;
int UDPServerElement = 0; int UDPServerElement = 0;
for (int i = 0; i < m_udpServers.Count; i++) for (int i = 0; i < m_clientServers.Count; i++)
{ {
if (m_udpServers[i].RegionHandle == whichRegion.RegionHandle) if (m_clientServers[i].HandlesRegion(new Location(whichRegion.RegionHandle)))
{ {
UDPServerElement = i; UDPServerElement = i;
foundUDPServer = true; foundUDPServer = true;
@ -598,8 +599,8 @@ namespace OpenSim
if (foundUDPServer) if (foundUDPServer)
{ {
// m_udpServers[UDPServerElement].Server.End // m_udpServers[UDPServerElement].Server.End
m_udpServers[UDPServerElement].Server.Close(); m_clientServers[UDPServerElement].Server.Close();
m_udpServers.RemoveAt(UDPServerElement); m_clientServers.RemoveAt(UDPServerElement);
} }
//Removing the region from the sim's database of regions.. //Removing the region from the sim's database of regions..

View File

@ -32,14 +32,13 @@ using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using System.Timers;
using libsecondlife; using libsecondlife;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack; using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using Timer=System.Timers.Timer; using Timer=System.Timers.Timer;
@ -111,8 +110,8 @@ namespace OpenSim
{ {
m_scriptTimer = new Timer(); m_scriptTimer = new Timer();
m_scriptTimer.Enabled = true; m_scriptTimer.Enabled = true;
m_scriptTimer.Interval = (int)(1200 * 1000); m_scriptTimer.Interval = 1200 * 1000;
m_scriptTimer.Elapsed += new ElapsedEventHandler(RunAutoTimerScript); m_scriptTimer.Elapsed += RunAutoTimerScript;
} }
PrintFileToConsole("startuplogo.txt"); PrintFileToConsole("startuplogo.txt");
} }
@ -156,7 +155,7 @@ namespace OpenSim
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
StreamReader readFile = File.OpenText(fileName); StreamReader readFile = File.OpenText(fileName);
string currentCommand = String.Empty; string currentCommand;
while ((currentCommand = readFile.ReadLine()) != null) while ((currentCommand = readFile.ReadLine()) != null)
{ {
if (currentCommand != String.Empty) if (currentCommand != String.Empty)
@ -177,7 +176,7 @@ namespace OpenSim
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
StreamReader readFile = File.OpenText(fileName); StreamReader readFile = File.OpenText(fileName);
string currentLine = String.Empty; string currentLine;
while ((currentLine = readFile.ReadLine()) != null) while ((currentLine = readFile.ReadLine()) != null)
{ {
m_log.Info("[!]" + currentLine); m_log.Info("[!]" + currentLine);
@ -609,55 +608,6 @@ namespace OpenSim
m_assetCache.ShowState(); m_assetCache.ShowState();
break; break;
case "users":
IList agents = m_sceneManager.GetCurrentSceneAvatars();
m_console.Notice(String.Format("\nAgents connected: {0}\n", agents.Count));
m_console.Notice(
String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}{6,-15}", "Firstname", "Lastname",
"Agent ID", "Circuit", "IP", "Region", "Status"));
foreach (ScenePresence presence in agents)
{
RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
string regionName;
EndPoint ep = null;
if (regionInfo == null)
{
regionName = "Unresolvable";
}
else
{
regionName = regionInfo.RegionName;
}
for (int i = 0; i < m_udpServers.Count; i++)
{
if (m_udpServers[i].RegionHandle == presence.RegionHandle)
{
m_udpServers[i].clientCircuits_reverse.TryGetValue(presence.ControllingClient.CircuitCode, out ep);
}
}
m_console.Notice(
String.Format(
"{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}{6,-15}",
presence.Firstname,
presence.Lastname,
presence.UUID,
presence.ControllingClient.CircuitCode,
ep,
regionName,
((((ClientView)presence.ControllingClient).PacketProcessingEnabled)
?"Active client":"Standby client")));
}
m_console.Notice("");
break;
case "modules": case "modules":
m_console.Notice("The currently loaded shared modules are:"); m_console.Notice("The currently loaded shared modules are:");
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)

View File

@ -0,0 +1,11 @@
using System.Net.Sockets;
using OpenSim.Framework;
namespace OpenSim.Region.ClientStack
{
public interface IClientNetworkServer
{
Socket Server { get; }
bool HandlesRegion(Location x);
}
}

View File

@ -1,38 +1,38 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Net.Sockets; using System.Net.Sockets;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public interface ClientStackNetworkHandler public interface LLClientStackNetworkHandler
{ {
void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender); void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender);
void RemoveClientCircuit(uint circuitcode); void RemoveClientCircuit(uint circuitcode);
void RegisterPacketServer(PacketServer server); void RegisterPacketServer(LLPacketServer server);
} }
} }

View File

@ -1,149 +1,150 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.ClientStack.LindenUDP;
namespace OpenSim.Region.ClientStack
{ namespace OpenSim.Region.ClientStack.LindenUDP
public class PacketServer {
{ public class LLPacketServer
//private static readonly log4net.ILog m_log {
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private ClientStackNetworkHandler m_networkHandler;
private IScene m_scene; private LLClientStackNetworkHandler m_networkHandler;
private IScene m_scene;
//private readonly ClientManager m_clientManager = new ClientManager();
//public ClientManager ClientManager //private readonly ClientManager m_clientManager = new ClientManager();
//{ //public ClientManager ClientManager
// get { return m_clientManager; } //{
//} // get { return m_clientManager; }
//}
public PacketServer(ClientStackNetworkHandler networkHandler)
{ public LLPacketServer(LLClientStackNetworkHandler networkHandler)
m_networkHandler = networkHandler; {
m_networkHandler.RegisterPacketServer(this); m_networkHandler = networkHandler;
} m_networkHandler.RegisterPacketServer(this);
}
public IScene LocalScene
{ public IScene LocalScene
set { m_scene = value; } {
} set { m_scene = value; }
}
/// <summary>
/// /// <summary>
/// </summary> ///
/// <param name="circuitCode"></param> /// </summary>
/// <param name="packet"></param> /// <param name="circuitCode"></param>
public virtual void InPacket(uint circuitCode, Packet packet) /// <param name="packet"></param>
{ public virtual void InPacket(uint circuitCode, Packet packet)
m_scene.ClientManager.InPacket(circuitCode, packet); {
} m_scene.ClientManager.InPacket(circuitCode, packet);
}
protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
ClientManager clientManager, IScene scene, AssetCache assetCache, protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
PacketServer packServer, AgentCircuitManager authenSessions, ClientManager clientManager, IScene scene, AssetCache assetCache,
LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP) LLPacketServer packServer, AgentCircuitManager authenSessions,
{ LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
return {
new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP); return
} new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP);
}
public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP) public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
{ AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP)
IClientAPI newuser; {
IClientAPI newuser;
if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser))
{ if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser))
return false; {
} return false;
else }
{ else
newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this, {
authenticateSessionsClass, useCircuit.CircuitCode.ID, newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this,
useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP); authenticateSessionsClass, useCircuit.CircuitCode.ID,
useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP);
m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser);
m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser);
newuser.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler;
newuser.OnLogout += LogoutHandler; newuser.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler;
newuser.OnConnectionClosed += CloseClient; newuser.OnLogout += LogoutHandler;
newuser.OnConnectionClosed += CloseClient;
return true;
} return true;
} }
}
public void LogoutHandler(IClientAPI client)
{ public void LogoutHandler(IClientAPI client)
client.SendLogoutPacket(); {
client.SendLogoutPacket();
CloseClient(client);
} CloseClient(client);
}
/// <summary>
/// /// <summary>
/// </summary> ///
/// <param name="buffer"></param> /// </summary>
/// <param name="size"></param> /// <param name="buffer"></param>
/// <param name="flags"></param> /// <param name="size"></param>
/// <param name="circuitcode"></param> /// <param name="flags"></param>
public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) /// <param name="circuitcode"></param>
{ public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); {
} m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode);
}
/// <summary>
/// /// <summary>
/// </summary> ///
/// <param name="circuitcode"></param> /// </summary>
public virtual void CloseCircuit(uint circuitcode) /// <param name="circuitcode"></param>
{ public virtual void CloseCircuit(uint circuitcode)
m_networkHandler.RemoveClientCircuit(circuitcode); {
m_networkHandler.RemoveClientCircuit(circuitcode);
//m_scene.ClientManager.CloseAllAgents(circuitcode);
} //m_scene.ClientManager.CloseAllAgents(circuitcode);
}
/// <summary>
/// Completely close down the given client. /// <summary>
/// </summary> /// Completely close down the given client.
/// <param name="client"></param> /// </summary>
public virtual void CloseClient(IClientAPI client) /// <param name="client"></param>
{ public virtual void CloseClient(IClientAPI client)
//m_log.Info("PacketServer:CloseClient()"); {
//m_log.Info("PacketServer:CloseClient()");
CloseCircuit(client.CircuitCode);
m_scene.ClientManager.Remove(client.CircuitCode); CloseCircuit(client.CircuitCode);
client.Close(false); m_scene.ClientManager.Remove(client.CircuitCode);
} client.Close(false);
} }
} }
}

View File

@ -1,93 +1,93 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class PacketThrottle public class LLPacketThrottle
{ {
private int max; // max allowable throttle private int max; // max allowable throttle
private int min; // min allowable throttle private int min; // min allowable throttle
private int throttle; // current throttle setting private int throttle; // current throttle setting
private static int divisor = 7; // the throttle time divisor, this probably should factor out private static int divisor = 7; // the throttle time divisor, this probably should factor out
private int sent; // current number of bytes sent private int sent; // current number of bytes sent
public PacketThrottle(int Min, int Max, int Throttle) public LLPacketThrottle(int Min, int Max, int Throttle)
{ {
max = Max; max = Max;
min = Min; min = Min;
throttle = Throttle; throttle = Throttle;
sent = 0; sent = 0;
} }
public void Reset() public void Reset()
{ {
sent = 0; sent = 0;
} }
public bool UnderLimit() public bool UnderLimit()
{ {
return (sent < (throttle/divisor)); return (sent < (throttle/divisor));
} }
public int Add(int bytes) public int Add(int bytes)
{ {
sent += bytes; sent += bytes;
return sent; return sent;
} }
// Properties // Properties
public int Max public int Max
{ {
get { return max; } get { return max; }
} }
public int Min public int Min
{ {
get { return min; } get { return min; }
} }
public int Throttle public int Throttle
{ {
get { return throttle; } get { return throttle; }
set set
{ {
if (value > max) if (value > max)
{ {
throttle = max; throttle = max;
} }
else if (value < min) else if (value < min)
{ {
throttle = min; throttle = min;
} }
else else
{ {
throttle = value; throttle = value;
} }
} }
} }
} }
} }

View File

@ -1,43 +1,43 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework; using OpenSim.Framework;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class QueItem public class LLQueItem
{ {
public QueItem() public LLQueItem()
{ {
} }
public Packet Packet; public Packet Packet;
public bool Incoming; public bool Incoming;
public ThrottleOutPacketType throttleType; public ThrottleOutPacketType throttleType;
} }
} }

View File

@ -1,488 +1,499 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Reflection; using System.Reflection;
using libsecondlife.Packets; using libsecondlife.Packets;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.ClientStack.LindenUDP;
namespace OpenSim.Region.ClientStack
{ namespace OpenSim.Region.ClientStack.LindenUDP
public class UDPServer : ClientStackNetworkHandler {
{ public class LLUDPServer : LLClientStackNetworkHandler, IClientNetworkServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>(); protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>(); public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>();
public Socket Server; protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>();
protected IPEndPoint ServerIncoming; private Socket m_socket;
protected byte[] RecvBuffer = new byte[4096]; protected IPEndPoint ServerIncoming;
protected byte[] ZeroBuffer = new byte[8192]; protected byte[] RecvBuffer = new byte[4096];
protected IPEndPoint ipeSender; protected byte[] ZeroBuffer = new byte[8192];
protected EndPoint epSender; protected IPEndPoint ipeSender;
protected EndPoint epProxy; protected EndPoint epSender;
protected int proxyPortOffset; protected EndPoint epProxy;
protected AsyncCallback ReceivedData; protected int proxyPortOffset;
protected PacketServer m_packetServer; protected AsyncCallback ReceivedData;
protected ulong m_regionHandle; protected LLPacketServer m_packetServer;
protected Location m_location;
protected uint listenPort;
protected bool Allow_Alternate_Port; protected uint listenPort;
protected IPAddress listenIP = IPAddress.Parse("0.0.0.0"); protected bool Allow_Alternate_Port;
protected IScene m_localScene; protected IPAddress listenIP = IPAddress.Parse("0.0.0.0");
protected AssetCache m_assetCache; protected IScene m_localScene;
protected AgentCircuitManager m_authenticateSessionsClass; protected AssetCache m_assetCache;
protected AgentCircuitManager m_authenticateSessionsClass;
public PacketServer PacketServer
{ public LLPacketServer PacketServer
get { return m_packetServer; } {
set { m_packetServer = value; } get { return m_packetServer; }
} set { m_packetServer = value; }
}
public IScene LocalScene
{ public IScene LocalScene
set {
{ set
m_localScene = value; {
m_packetServer.LocalScene = m_localScene; m_localScene = value;
m_regionHandle = m_localScene.RegionInfo.RegionHandle; m_packetServer.LocalScene = m_localScene;
} m_location = new Location(m_localScene.RegionInfo.RegionHandle);
} }
}
public ulong RegionHandle
{ public ulong RegionHandle
get { return m_regionHandle; } {
} get { return m_location.RegionHandle; }
}
public UDPServer()
{ Socket IClientNetworkServer.Server
} {
get { return m_socket; }
public UDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) }
{
this.proxyPortOffset = proxyPortOffset; public bool HandlesRegion(Location x)
listenPort = (uint) (port + proxyPortOffset); {
listenIP = _listenIP; return x == m_location;
Allow_Alternate_Port = allow_alternate_port; }
m_assetCache = assetCache;
m_authenticateSessionsClass = authenticateClass; public LLUDPServer()
CreatePacketServer(); {
}
// Return new port
// This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered. public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
// So the option allow_alternate_ports="true" was added to default.xml {
port = (uint)(listenPort - proxyPortOffset); this.proxyPortOffset = proxyPortOffset;
} listenPort = (uint) (port + proxyPortOffset);
listenIP = _listenIP;
protected virtual void CreatePacketServer() Allow_Alternate_Port = allow_alternate_port;
{ m_assetCache = assetCache;
PacketServer packetServer = new PacketServer(this); m_authenticateSessionsClass = authenticateClass;
} CreatePacketServer();
protected virtual void OnReceivedData(IAsyncResult result) // Return new port
{ // This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered.
ipeSender = new IPEndPoint(listenIP, 0); // So the option allow_alternate_ports="true" was added to default.xml
epSender = (EndPoint) ipeSender; port = (uint)(listenPort - proxyPortOffset);
Packet packet = null; }
int numBytes = 1; protected virtual void CreatePacketServer()
{
try LLPacketServer packetServer = new LLPacketServer(this);
{ }
numBytes = Server.EndReceiveFrom(result, ref epSender);
} protected virtual void OnReceivedData(IAsyncResult result)
catch (SocketException e) {
{ ipeSender = new IPEndPoint(listenIP, 0);
// TODO : Actually only handle those states that we have control over, re-throw everything else, epSender = (EndPoint) ipeSender;
// TODO: implement cases as we encounter them. Packet packet = null;
//m_log.Error("[UDPSERVER]: Connection Error! - " + e.ToString());
switch (e.SocketErrorCode) int numBytes = 1;
{
case SocketError.AlreadyInProgress: try
case SocketError.NetworkReset: {
case SocketError.ConnectionReset: numBytes = m_socket.EndReceiveFrom(result, ref epSender);
try }
{ catch (SocketException e)
CloseEndPoint(epSender); {
} // TODO : Actually only handle those states that we have control over, re-throw everything else,
catch (Exception a) // TODO: implement cases as we encounter them.
{ //m_log.Error("[UDPSERVER]: Connection Error! - " + e.ToString());
m_log.Info("[UDPSERVER]: " + a.ToString()); switch (e.SocketErrorCode)
} {
try case SocketError.AlreadyInProgress:
{ case SocketError.NetworkReset:
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, case SocketError.ConnectionReset:
ReceivedData, null); try
{
// Ter: For some stupid reason ConnectionReset basically kills our async event structure.. CloseEndPoint(epSender);
// so therefore.. we've got to tell the server to BeginReceiveFrom again. }
// This will happen over and over until we've gone through all packets catch (Exception a)
// sent to and from this particular user. {
// Stupid I know.. m_log.Info("[UDPSERVER]: " + a.ToString());
// but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method. }
} try
catch (SocketException) {
{ m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
} ReceivedData, null);
break;
default: // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
try // so therefore.. we've got to tell the server to BeginReceiveFrom again.
{ // This will happen over and over until we've gone through all packets
CloseEndPoint(epSender); // sent to and from this particular user.
} // Stupid I know..
catch (Exception) // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
{ }
//m_log.Info("[UDPSERVER]" + a.ToString()); catch (SocketException)
} {
try }
{ break;
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, default:
ReceivedData, null); try
{
// Ter: For some stupid reason ConnectionReset basically kills our async event structure.. CloseEndPoint(epSender);
// so therefore.. we've got to tell the server to BeginReceiveFrom again. }
// This will happen over and over until we've gone through all packets catch (Exception)
// sent to and from this particular user. {
// Stupid I know.. //m_log.Info("[UDPSERVER]" + a.ToString());
// but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method. }
} try
catch (SocketException e2) {
{ m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
m_log.Error("[UDPSERVER]: " + e2.ToString()); ReceivedData, null);
}
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
// Here's some reference code! :D // so therefore.. we've got to tell the server to BeginReceiveFrom again.
// Shutdown and restart the UDP listener! hehe // This will happen over and over until we've gone through all packets
// Shiny // sent to and from this particular user.
// Stupid I know..
//Server.Shutdown(SocketShutdown.Both); // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
//CloseEndPoint(epSender); }
//ServerListener(); catch (SocketException e2)
break; {
} m_log.Error("[UDPSERVER]: " + e2.ToString());
}
//return;
} // Here's some reference code! :D
catch (ObjectDisposedException e) // Shutdown and restart the UDP listener! hehe
{ // Shiny
m_log.Debug("[UDPSERVER]: " + e.ToString());
try //Server.Shutdown(SocketShutdown.Both);
{ //CloseEndPoint(epSender);
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, //ServerListener();
ReceivedData, null); break;
}
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
// so therefore.. we've got to tell the server to BeginReceiveFrom again. //return;
// This will happen over and over until we've gone through all packets }
// sent to and from this particular user. catch (ObjectDisposedException e)
// Stupid I know.. {
// but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method. m_log.Debug("[UDPSERVER]: " + e.ToString());
} try
{
catch (SocketException e2) m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
{ ReceivedData, null);
m_log.Error("[UDPSERVER]: " + e2.ToString());
} // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
catch (ObjectDisposedException) // so therefore.. we've got to tell the server to BeginReceiveFrom again.
{ // This will happen over and over until we've gone through all packets
} // sent to and from this particular user.
//return; // Stupid I know..
} // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
}
//System.Console.WriteLine("UDPServer : recieved message from {0}", epSender.ToString());
epProxy = epSender; catch (SocketException e2)
if (proxyPortOffset != 0) {
{ m_log.Error("[UDPSERVER]: " + e2.ToString());
epSender = PacketPool.DecodeProxyMessage(RecvBuffer, ref numBytes); }
} catch (ObjectDisposedException)
{
int packetEnd = numBytes - 1; }
//return;
try }
{
packet = PacketPool.Instance.GetPacket(RecvBuffer, ref packetEnd, ZeroBuffer); //System.Console.WriteLine("UDPServer : recieved message from {0}", epSender.ToString());
} epProxy = epSender;
catch (Exception e) if (proxyPortOffset != 0)
{ {
m_log.Debug("[UDPSERVER]: " + e.ToString()); epSender = PacketPool.DecodeProxyMessage(RecvBuffer, ref numBytes);
} }
try int packetEnd = numBytes - 1;
{
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); try
} {
catch (SocketException) packet = PacketPool.Instance.GetPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
{ }
try catch (Exception e)
{ {
CloseEndPoint(epSender); m_log.Debug("[UDPSERVER]: " + e.ToString());
} }
catch (Exception a)
{ try
m_log.Info("[UDPSERVER]: " + a.ToString()); {
} m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
try }
{ catch (SocketException)
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, {
ReceivedData, null); try
{
// Ter: For some stupid reason ConnectionReset basically kills our async event structure.. CloseEndPoint(epSender);
// so therefore.. we've got to tell the server to BeginReceiveFrom again. }
// This will happen over and over until we've gone through all packets catch (Exception a)
// sent to and from this particular user. {
// Stupid I know.. m_log.Info("[UDPSERVER]: " + a.ToString());
// but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method. }
} try
catch (SocketException e5) {
{ m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
m_log.Error("[UDPSERVER]: " + e5.ToString()); ReceivedData, null);
}
} // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
catch (ObjectDisposedException) // so therefore.. we've got to tell the server to BeginReceiveFrom again.
{ // This will happen over and over until we've gone through all packets
} // sent to and from this particular user.
// Stupid I know..
if (packet != null) // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
{ }
try catch (SocketException e5)
{ {
// do we already have a circuit for this endpoint m_log.Error("[UDPSERVER]: " + e5.ToString());
uint circuit; }
}
bool ret = false; catch (ObjectDisposedException)
lock (clientCircuits) {
{ }
ret = clientCircuits.TryGetValue(epSender, out circuit);
} if (packet != null)
if (ret) {
{ try
//if so then send packet to the packetserver {
//m_log.Warn("[UDPSERVER]: ALREADY HAVE Circuit!"); // do we already have a circuit for this endpoint
m_packetServer.InPacket(circuit, packet); uint circuit;
}
else if (packet.Type == PacketType.UseCircuitCode) bool ret = false;
{ lock (clientCircuits)
// new client {
m_log.Debug("[UDPSERVER]: Adding New Client"); ret = clientCircuits.TryGetValue(epSender, out circuit);
AddNewClient(packet); }
if (ret)
UseCircuitCodePacket p = (UseCircuitCodePacket)packet; {
//if so then send packet to the packetserver
// Ack the first UseCircuitCode packet //m_log.Warn("[UDPSERVER]: ALREADY HAVE Circuit!");
PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck); m_packetServer.InPacket(circuit, packet);
// TODO: don't create new blocks if recycling an old packet }
ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; else if (packet.Type == PacketType.UseCircuitCode)
ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); {
ack_it.Packets[0].ID = packet.Header.Sequence; // new client
ack_it.Header.Reliable = false; m_log.Debug("[UDPSERVER]: Adding New Client");
SendPacketTo(ack_it.ToBytes(),ack_it.ToBytes().Length,SocketFlags.None,p.CircuitCode.Code); AddNewClient(packet);
}
else UseCircuitCodePacket p = (UseCircuitCodePacket)packet;
{
// invalid client // Ack the first UseCircuitCode packet
//CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck);
//m_log.Warn("[UDPSERVER]: Got a packet from an invalid client - " + packet.ToString()); // TODO: don't create new blocks if recycling an old packet
} ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
} ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
catch (Exception) ack_it.Packets[0].ID = packet.Header.Sequence;
{ ack_it.Header.Reliable = false;
m_log.Error("[UDPSERVER]: Exception in processing packet."); SendPacketTo(ack_it.ToBytes(),ack_it.ToBytes().Length,SocketFlags.None,p.CircuitCode.Code);
m_log.Debug("[UDPSERVER]: Adding New Client"); }
try else
{ {
AddNewClient(packet); // invalid client
} //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now
catch (Exception e3) //m_log.Warn("[UDPSERVER]: Got a packet from an invalid client - " + packet.ToString());
{ }
m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString()); }
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, catch (Exception)
ReceivedData, null); {
} m_log.Error("[UDPSERVER]: Exception in processing packet.");
} m_log.Debug("[UDPSERVER]: Adding New Client");
} try
{
} AddNewClient(packet);
}
private void CloseEndPoint(EndPoint sender) catch (Exception e3)
{ {
uint circuit; m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString());
lock (clientCircuits) m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
{ ReceivedData, null);
if (clientCircuits.TryGetValue(sender, out circuit)) }
{ }
m_packetServer.CloseCircuit(circuit); }
}
} }
}
private void CloseEndPoint(EndPoint sender)
protected virtual void AddNewClient(Packet packet) {
{ uint circuit;
//Slave regions don't accept new clients lock (clientCircuits)
if(m_localScene.Region_Status != RegionStatus.SlaveScene) {
{ if (clientCircuits.TryGetValue(sender, out circuit))
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet; {
lock (clientCircuits) m_packetServer.CloseCircuit(circuit);
{ }
if (!clientCircuits.ContainsKey(epSender)) }
clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); }
else
m_log.Error("[UDPSERVER]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); protected virtual void AddNewClient(Packet packet)
} {
lock (clientCircuits_reverse) //Slave regions don't accept new clients
{ if(m_localScene.Region_Status != RegionStatus.SlaveScene)
if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code)) {
clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, epSender); UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet;
else lock (clientCircuits)
m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); {
} if (!clientCircuits.ContainsKey(epSender))
clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
lock (proxyCircuits) else
{ m_log.Error("[UDPSERVER]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
if (!proxyCircuits.ContainsKey(useCircuit.CircuitCode.Code)) }
proxyCircuits.Add(useCircuit.CircuitCode.Code, epProxy); lock (clientCircuits_reverse)
else {
m_log.Error("[UDPSERVER]: proxyCircuits already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code))
} clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, epSender);
else
PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass, epProxy); m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
} }
PacketPool.Instance.ReturnPacket(packet);
} lock (proxyCircuits)
{
public void ServerListener() if (!proxyCircuits.ContainsKey(useCircuit.CircuitCode.Code))
{ proxyCircuits.Add(useCircuit.CircuitCode.Code, epProxy);
uint newPort = listenPort; else
m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + "."); m_log.Error("[UDPSERVER]: proxyCircuits already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
}
ServerIncoming = new IPEndPoint(listenIP, (int)newPort);
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass, epProxy);
Server.Bind(ServerIncoming); }
listenPort = newPort; PacketPool.Instance.ReturnPacket(packet);
}
m_log.Info("[SERVER]: UDP socket bound, getting ready to listen");
public void ServerListener()
ipeSender = new IPEndPoint(listenIP, 0); {
epSender = (EndPoint)ipeSender; uint newPort = listenPort;
ReceivedData = new AsyncCallback(OnReceivedData); m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
ServerIncoming = new IPEndPoint(listenIP, (int)newPort);
m_log.Info("[SERVER]: Listening on port " + newPort); m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
} m_socket.Bind(ServerIncoming);
listenPort = newPort;
public virtual void RegisterPacketServer(PacketServer server)
{ m_log.Info("[SERVER]: UDP socket bound, getting ready to listen");
m_packetServer = server;
} ipeSender = new IPEndPoint(listenIP, 0);
epSender = (EndPoint)ipeSender;
public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) ReceivedData = new AsyncCallback(OnReceivedData);
//EndPoint packetSender) m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
{
// find the endpoint for this circuit m_log.Info("[SERVER]: Listening on port " + newPort);
EndPoint sendto = null; }
lock (clientCircuits_reverse)
{ public virtual void RegisterPacketServer(LLPacketServer server)
if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) {
{ m_packetServer = server;
//we found the endpoint so send the packet to it }
if (proxyPortOffset != 0)
{ public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString()); //EndPoint packetSender)
PacketPool.EncodeProxyMessage(buffer, ref size, sendto); {
Server.SendTo(buffer, size, flags, proxyCircuits[circuitcode]); // find the endpoint for this circuit
} EndPoint sendto = null;
else lock (clientCircuits_reverse)
{ {
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString()); if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
Server.SendTo(buffer, size, flags, sendto); {
} //we found the endpoint so send the packet to it
} if (proxyPortOffset != 0)
} {
} //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString());
PacketPool.EncodeProxyMessage(buffer, ref size, sendto);
public virtual void RemoveClientCircuit(uint circuitcode) m_socket.SendTo(buffer, size, flags, proxyCircuits[circuitcode]);
{ }
EndPoint sendto = null; else
lock (clientCircuits_reverse) {
{ //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString());
if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) m_socket.SendTo(buffer, size, flags, sendto);
{ }
clientCircuits.Remove(sendto); }
}
clientCircuits_reverse.Remove(circuitcode); }
proxyCircuits.Remove(circuitcode);
} public virtual void RemoveClientCircuit(uint circuitcode)
} {
} EndPoint sendto = null;
lock (clientCircuits_reverse)
public void RestoreClient(AgentCircuitData circuit, EndPoint userEP, EndPoint proxyEP) {
{ if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
//MainLog.Instance.Verbose("UDPSERVER", "RestoreClient"); {
clientCircuits.Remove(sendto);
UseCircuitCodePacket useCircuit = new UseCircuitCodePacket();
useCircuit.CircuitCode.Code = circuit.circuitcode; clientCircuits_reverse.Remove(circuitcode);
useCircuit.CircuitCode.ID = circuit.AgentID; proxyCircuits.Remove(circuitcode);
useCircuit.CircuitCode.SessionID = circuit.SessionID; }
}
lock (clientCircuits) }
{
if (!clientCircuits.ContainsKey(userEP)) public void RestoreClient(AgentCircuitData circuit, EndPoint userEP, EndPoint proxyEP)
clientCircuits.Add(userEP, useCircuit.CircuitCode.Code); {
else //MainLog.Instance.Verbose("UDPSERVER", "RestoreClient");
m_log.Error("[UDPSERVER]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
} UseCircuitCodePacket useCircuit = new UseCircuitCodePacket();
lock (clientCircuits_reverse) useCircuit.CircuitCode.Code = circuit.circuitcode;
{ useCircuit.CircuitCode.ID = circuit.AgentID;
if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code)) useCircuit.CircuitCode.SessionID = circuit.SessionID;
clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, userEP);
else lock (clientCircuits)
m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); {
} if (!clientCircuits.ContainsKey(userEP))
clientCircuits.Add(userEP, useCircuit.CircuitCode.Code);
lock (proxyCircuits) else
{ m_log.Error("[UDPSERVER]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
if (!proxyCircuits.ContainsKey(useCircuit.CircuitCode.Code)) }
{ lock (clientCircuits_reverse)
proxyCircuits.Add(useCircuit.CircuitCode.Code, proxyEP); {
} if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code))
else clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, userEP);
{ else
// re-set proxy endpoint m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
proxyCircuits.Remove(useCircuit.CircuitCode.Code); }
proxyCircuits.Add(useCircuit.CircuitCode.Code, proxyEP);
} lock (proxyCircuits)
} {
if (!proxyCircuits.ContainsKey(useCircuit.CircuitCode.Code))
PacketServer.AddNewClient(userEP, useCircuit, m_assetCache, m_authenticateSessionsClass, proxyEP); {
} proxyCircuits.Add(useCircuit.CircuitCode.Code, proxyEP);
} }
} else
{
// re-set proxy endpoint
proxyCircuits.Remove(useCircuit.CircuitCode.Code);
proxyCircuits.Add(useCircuit.CircuitCode.Code, proxyEP);
}
}
PacketServer.AddNewClient(userEP, useCircuit, m_assetCache, m_authenticateSessionsClass, proxyEP);
}
}
}

View File

@ -34,12 +34,11 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
//using OpenSim.Framework.Console;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack
{ {
public abstract class RegionApplicationBase : BaseOpenSimServer public abstract class RegionApplicationBase : BaseOpenSimServer
@ -75,7 +74,7 @@ namespace OpenSim.Region.ClientStack
public virtual void StartUp() public virtual void StartUp()
{ {
ClientView.TerrainManager = new TerrainManager(new SecondLife()); LLClientView.TerrainManager = new TerrainManager(new SecondLife());
m_storageManager = CreateStorageManager(m_storageConnectionString); m_storageManager = CreateStorageManager(m_storageConnectionString);
@ -108,12 +107,12 @@ namespace OpenSim.Region.ClientStack
return physicsPluginManager.GetPhysicsScene(engine, meshEngine); return physicsPluginManager.GetPhysicsScene(engine, meshEngine);
} }
protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer, bool m_permissions) protected Scene SetupScene(RegionInfo regionInfo, out LLUDPServer udpServer, bool m_permissions)
{ {
return SetupScene(regionInfo, 0, out udpServer, m_permissions); return SetupScene(regionInfo, 0, out udpServer, m_permissions);
} }
protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out UDPServer udpServer, bool m_permissions) protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out LLUDPServer udpServer, bool m_permissions)
{ {
AgentCircuitManager circuitManager = new AgentCircuitManager(); AgentCircuitManager circuitManager = new AgentCircuitManager();
IPAddress listenIP = regionInfo.InternalEndPoint.Address; IPAddress listenIP = regionInfo.InternalEndPoint.Address;
@ -121,7 +120,7 @@ namespace OpenSim.Region.ClientStack
// listenIP = IPAddress.Parse("0.0.0.0"); // listenIP = IPAddress.Parse("0.0.0.0");
uint port = (uint) regionInfo.InternalEndPoint.Port; uint port = (uint) regionInfo.InternalEndPoint.Port;
udpServer = new UDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager); udpServer = new LLUDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager);
regionInfo.InternalEndPoint.Port = (int)port; regionInfo.InternalEndPoint.Port = (int)port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
@ -131,8 +130,8 @@ namespace OpenSim.Region.ClientStack
scene.LoadWorldMap(); scene.LoadWorldMap();
//moved to opensimMain as these have to happen after modules are initialised //moved to opensimMain as these have to happen after modules are initialised
// scene.CreateTerrainTexture(true); // scene.CreateTerrainTexture(true);
// scene.RegisterRegionWithGrid(); // scene.RegisterRegionWithGrid();
scene.PhysicsScene = GetPhysicsScene(); scene.PhysicsScene = GetPhysicsScene();
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
@ -171,4 +170,4 @@ namespace OpenSim.Region.ClientStack
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager); AgentCircuitManager circuitManager);
} }
} }

View File

@ -11,5 +11,6 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
T[] RequestInterface<T>(); T[] RequestInterface<T>();
Location GetLocationByDirection(Scene scene, InterregionModule.Direction dir); Location GetLocationByDirection(Scene scene, InterregionModule.Direction dir);
void internal_CreateRemotingObjects(); void internal_CreateRemotingObjects();
void RegisterRemoteRegion(string uri);
} }
} }

View File

@ -29,14 +29,14 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion #endregion
private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>(); private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>();
private readonly Object m_lockObject = new object();
private readonly List<Location> m_myLocations = new List<Location>(); private readonly List<Location> m_myLocations = new List<Location>();
private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>(); private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>(); private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
private IConfigSource m_config; private IConfigSource m_config;
private bool m_enabled = false; private const bool m_enabled = false;
private Object m_lockObject = new object();
private RemotingObject m_myRemote; private RemotingObject m_myRemote;
private TcpChannel m_tcpChannel; private TcpChannel m_tcpChannel;
private int m_tcpPort = 10101; private int m_tcpPort = 10101;
@ -81,10 +81,7 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
{ {
return m_neighbourRemote[loc].RequestInterface<T>(); return m_neighbourRemote[loc].RequestInterface<T>();
} }
else throw new IndexOutOfRangeException("No neighbour availible at that location");
{
throw new IndexOutOfRangeException("No neighbour availible at that location");
}
} }
public T[] RequestInterface<T>() public T[] RequestInterface<T>()
@ -108,25 +105,24 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
return new Location(0, 0); return new Location(0, 0);
} }
#endregion public void RegisterRemoteRegion(string uri)
{
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
}
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated. #endregion
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource source) public void Initialise(Scene scene, IConfigSource source)
{ {
if (m_enabled) m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
{ (int) scene.RegionInfo.RegionLocY));
m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX, m_config = source;
(int) scene.RegionInfo.RegionLocY));
m_config = source;
scene.RegisterModuleInterface<IInterregionModule>(this); scene.RegisterModuleInterface<IInterregionModule>(this);
}
} }
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
public void PostInitialise() public void PostInitialise()
{ {
if (m_enabled) if (m_enabled)
@ -160,11 +156,6 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion #endregion
public void RegisterRemoteRegion(string uri)
{
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
}
private void RegisterRemotingInterface(RemotingObject remote) private void RegisterRemotingInterface(RemotingObject remote)
{ {
Location[] locs = remote.GetLocations(); Location[] locs = remote.GetLocations();

View File

@ -224,6 +224,12 @@ namespace OpenSim.Region.Examples.SimpleModule
get { return FirstName + LastName; } get { return FirstName + LastName; }
} }
public bool IsActive
{
get { return true; }
set { }
}
public virtual int NextAnimationSequenceNumber public virtual int NextAnimationSequenceNumber
{ {
get { return 1; } get { return 1; }