| 1 |
using OpenSim.Region.ClientStack; |
using OpenSim.Region.ClientStack; |
| 2 |
using OpenSim.Region.ClientStack.LindenUDP; |
using OpenSim.Region.ClientStack.LindenUDP; |
| 3 |
|
using System.Net; |
| 4 |
|
using Nini.Config; |
| 5 |
|
using OpenSim.Framework; |
| 6 |
|
using log4net; |
| 7 |
|
using System.Reflection; |
| 8 |
|
|
| 9 |
namespace ModularRex.RexNetwork |
namespace ModularRex.RexNetwork |
| 10 |
{ |
{ |
| 16 |
/// </summary> |
/// </summary> |
| 17 |
public class RexUDPServer : LLUDPServer |
public class RexUDPServer : LLUDPServer |
| 18 |
{ |
{ |
| 19 |
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
| 20 |
|
|
| 21 |
|
public RexUDPServer() { } |
| 22 |
|
|
| 23 |
|
public RexUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, |
| 24 |
|
AgentCircuitManager authenticateClass) |
| 25 |
|
{ |
| 26 |
|
Init(_listenIP, ref port, proxyPortOffset, allow_alternate_port, configSource, authenticateClass); |
| 27 |
|
} |
| 28 |
|
|
| 29 |
protected override void CreatePacketServer(ClientStackUserSettings userSettings) |
protected override void CreatePacketServer(ClientStackUserSettings userSettings) |
| 30 |
{ |
{ |
| 31 |
new RexPacketServer(this, userSettings); |
new RexPacketServer(this, userSettings); |
| 32 |
} |
} |
| 33 |
|
|
| 34 |
|
protected void CreatePacketServer(ClientStackUserSettings userSettings, string clientToSpawn) |
| 35 |
|
{ |
| 36 |
|
new RexPacketServer(this, userSettings, clientToSpawn); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
protected void Init(IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, |
| 40 |
|
AgentCircuitManager circuitManager) |
| 41 |
|
{ |
| 42 |
|
ClientStackUserSettings userSettings = new ClientStackUserSettings(); |
| 43 |
|
|
| 44 |
|
IConfig config = configSource.Configs["ClientStack.LindenUDP"]; |
| 45 |
|
|
| 46 |
|
if (config != null) |
| 47 |
|
{ |
| 48 |
|
if (config.Contains("client_throttle_max_bps")) |
| 49 |
|
{ |
| 50 |
|
int maxBPS = config.GetInt("client_throttle_max_bps", 1500000); |
| 51 |
|
userSettings.TotalThrottleSettings = new ThrottleSettings(0, maxBPS, |
| 52 |
|
maxBPS > 28000 ? maxBPS : 28000); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
if (config.Contains("client_throttle_multiplier")) |
| 56 |
|
userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier"); |
| 57 |
|
if (config.Contains("client_socket_rcvbuf_size")) |
| 58 |
|
m_clientSocketReceiveBuffer = config.GetInt("client_socket_rcvbuf_size"); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
m_log.DebugFormat("[CLIENT]: client_throttle_multiplier = {0}", userSettings.ClientThrottleMultipler); |
| 62 |
|
m_log.DebugFormat("[CLIENT]: client_socket_rcvbuf_size = {0}", (m_clientSocketReceiveBuffer != 0 ? |
| 63 |
|
m_clientSocketReceiveBuffer.ToString() : "OS default")); |
| 64 |
|
string clientToSpawn = "default"; |
| 65 |
|
IConfig rexConfig = configSource.Configs["realXtend"]; |
| 66 |
|
if (rexConfig != null) |
| 67 |
|
{ |
| 68 |
|
if (rexConfig.Contains("ClientView")) |
| 69 |
|
{ |
| 70 |
|
clientToSpawn = rexConfig.Get("ClientView", "default"); |
| 71 |
|
} |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
proxyPortOffset = proxyPortOffsetParm; |
| 75 |
|
listenPort = (uint)(port + proxyPortOffsetParm); |
| 76 |
|
listenIP = _listenIP; |
| 77 |
|
Allow_Alternate_Port = allow_alternate_port; |
| 78 |
|
m_circuitManager = circuitManager; |
| 79 |
|
CreatePacketServer(userSettings, clientToSpawn); |
| 80 |
|
|
| 81 |
|
// Return new port |
| 82 |
|
// This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered. |
| 83 |
|
// So the option allow_alternate_ports="true" was added to default.xml |
| 84 |
|
port = (uint)(listenPort - proxyPortOffsetParm); |
| 85 |
|
} |
| 86 |
} |
} |
| 87 |
} |
} |