diff options
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/ClientView.cs')
-rw-r--r-- | OpenSim/OpenSim.RegionServer/ClientView.cs | 97 |
1 files changed, 26 insertions, 71 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs index a422102..0419b7a 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.cs | |||
@@ -35,11 +35,11 @@ using System.Net.Sockets; | |||
35 | using System.IO; | 35 | using System.IO; |
36 | using System.Threading; | 36 | using System.Threading; |
37 | using System.Timers; | 37 | using System.Timers; |
38 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Interfaces; | 39 | using OpenSim.Framework.Interfaces; |
39 | using OpenSim.Framework.Types; | 40 | using OpenSim.Framework.Types; |
40 | using OpenSim.Framework.Inventory; | 41 | using OpenSim.Framework.Inventory; |
41 | using OpenSim.Framework.Utilities; | 42 | using OpenSim.Framework.Utilities; |
42 | using OpenSim.world; | ||
43 | using OpenSim.Assets; | 43 | using OpenSim.Assets; |
44 | 44 | ||
45 | namespace OpenSim | 45 | namespace OpenSim |
@@ -58,73 +58,40 @@ namespace OpenSim | |||
58 | public LLUUID AgentID; | 58 | public LLUUID AgentID; |
59 | public LLUUID SessionID; | 59 | public LLUUID SessionID; |
60 | public LLUUID SecureSessionID = LLUUID.Zero; | 60 | public LLUUID SecureSessionID = LLUUID.Zero; |
61 | public bool m_child; | 61 | public bool m_child = false; |
62 | public world.Avatar ClientAvatar; | ||
63 | private UseCircuitCodePacket cirpack; | 62 | private UseCircuitCodePacket cirpack; |
64 | public Thread ClientThread; | 63 | public Thread ClientThread; |
65 | public LLVector3 startpos; | 64 | public LLVector3 startpos; |
66 | 65 | ||
67 | private AgentAssetUpload UploadAssets; | 66 | private AgentAssetUpload UploadAssets; |
68 | private LLUUID newAssetFolder = LLUUID.Zero; | 67 | private LLUUID newAssetFolder = LLUUID.Zero; |
69 | private bool debug = false; | 68 | private bool debug = false; |
70 | private World m_world; | 69 | private IWorld m_world; |
71 | private Dictionary<uint, ClientView> m_clientThreads; | 70 | private Dictionary<uint, ClientView> m_clientThreads; |
72 | private AssetCache m_assetCache; | 71 | private AssetCache m_assetCache; |
73 | private IGridServer m_gridServer; | 72 | private IGridServer m_gridServer; |
74 | private IUserServer m_userServer = null; | ||
75 | private InventoryCache m_inventoryCache; | 73 | private InventoryCache m_inventoryCache; |
76 | public bool m_sandboxMode; | ||
77 | private int cachedtextureserial = 0; | 74 | private int cachedtextureserial = 0; |
78 | private RegionInfo m_regionData; | 75 | private RegionInfo m_regionData; |
79 | protected AuthenticateSessionsBase m_authenticateSessionsHandler; | 76 | protected AuthenticateSessionsBase m_authenticateSessionsHandler; |
80 | 77 | ||
81 | public IUserServer UserServer | ||
82 | { | ||
83 | set | ||
84 | { | ||
85 | this.m_userServer = value; | ||
86 | } | ||
87 | } | ||
88 | 78 | ||
89 | public LLVector3 StartPos | 79 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) |
90 | { | 80 | { |
91 | get | ||
92 | { | ||
93 | return startpos; | ||
94 | } | ||
95 | set | ||
96 | { | ||
97 | startpos = value; | ||
98 | } | ||
99 | } | ||
100 | 81 | ||
101 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, ClientView> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat, AuthenticateSessionsBase authenSessions) | ||
102 | { | ||
103 | m_world = world; | ||
104 | m_clientThreads = clientThreads; | 82 | m_clientThreads = clientThreads; |
105 | m_assetCache = assetCache; | 83 | m_assetCache = assetCache; |
106 | m_gridServer = gridServer; | 84 | |
107 | m_networkServer = application; | 85 | m_networkServer = packServer; |
108 | m_inventoryCache = inventoryCache; | 86 | m_inventoryCache = inventoryCache; |
109 | m_sandboxMode = sandboxMode; | ||
110 | m_child = child; | ||
111 | m_regionData = regionDat; | ||
112 | m_authenticateSessionsHandler = authenSessions; | 87 | m_authenticateSessionsHandler = authenSessions; |
113 | 88 | ||
114 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request"); | 89 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request"); |
115 | cirpack = initialcirpack; | 90 | cirpack = initialcirpack; |
116 | userEP = remoteEP; | 91 | userEP = remoteEP; |
117 | 92 | ||
118 | if (m_gridServer.GetName() == "Remote") | 93 | this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); |
119 | { | 94 | this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); |
120 | this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); | ||
121 | this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); | ||
122 | //Console.WriteLine("start pos is " + this.startpos.X + " , " + this.startpos.Y + " , " + this.startpos.Z); | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 15.0f); // new LLVector3(128.0f, 128.0f, 60f); | ||
127 | } | ||
128 | 95 | ||
129 | PacketQueue = new BlockingQueue<QueItem>(); | 96 | PacketQueue = new BlockingQueue<QueItem>(); |
130 | 97 | ||
@@ -146,11 +113,10 @@ namespace OpenSim | |||
146 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); | 113 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); |
147 | this.m_child = false; | 114 | this.m_child = false; |
148 | //this.m_world.RemoveViewerAgent(this); | 115 | //this.m_world.RemoveViewerAgent(this); |
149 | if (!this.m_sandboxMode) | 116 | |
150 | { | 117 | this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); |
151 | this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); | 118 | m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); |
152 | m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); | 119 | |
153 | } | ||
154 | OnChildAgentStatus(this.m_child); | 120 | OnChildAgentStatus(this.m_child); |
155 | //this.InitNewClient(); | 121 | //this.InitNewClient(); |
156 | } | 122 | } |
@@ -169,21 +135,16 @@ namespace OpenSim | |||
169 | KillObjectPacket kill = new KillObjectPacket(); | 135 | KillObjectPacket kill = new KillObjectPacket(); |
170 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | 136 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; |
171 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | 137 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); |
172 | kill.ObjectData[0].ID = this.ClientAvatar.localid; | 138 | //kill.ObjectData[0].ID = this.ClientAvatar.localid; |
173 | foreach (ClientView client in m_clientThreads.Values) | 139 | foreach (ClientView client in m_clientThreads.Values) |
174 | { | 140 | { |
175 | client.OutPacket(kill); | 141 | client.OutPacket(kill); |
176 | } | 142 | } |
177 | if (this.m_userServer != null) | ||
178 | { | ||
179 | this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); | ||
184 | } | ||
185 | 143 | ||
186 | m_world.RemoveViewerAgent(this); | 144 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); |
145 | |||
146 | |||
147 | // m_world.RemoveViewerAgent(this); | ||
187 | 148 | ||
188 | m_clientThreads.Remove(this.CircuitCode); | 149 | m_clientThreads.Remove(this.CircuitCode); |
189 | m_networkServer.RemoveClientCircuit(this.CircuitCode); | 150 | m_networkServer.RemoveClientCircuit(this.CircuitCode); |
@@ -270,13 +231,13 @@ namespace OpenSim | |||
270 | protected virtual void InitNewClient() | 231 | protected virtual void InitNewClient() |
271 | { | 232 | { |
272 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); | 233 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); |
273 | this.ClientAvatar = m_world.AddViewerAgent(this); | 234 | // this.ClientAvatar = m_world.AddViewerAgent(this); |
274 | } | 235 | } |
275 | 236 | ||
276 | protected virtual void AuthUser() | 237 | protected virtual void AuthUser() |
277 | { | 238 | { |
278 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); | 239 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); |
279 | AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); | 240 | AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); |
280 | if (!sessionInfo.Authorised) | 241 | if (!sessionInfo.Authorised) |
281 | { | 242 | { |
282 | //session/circuit not authorised | 243 | //session/circuit not authorised |
@@ -290,20 +251,14 @@ namespace OpenSim | |||
290 | this.AgentID = cirpack.CircuitCode.ID; | 251 | this.AgentID = cirpack.CircuitCode.ID; |
291 | this.SessionID = cirpack.CircuitCode.SessionID; | 252 | this.SessionID = cirpack.CircuitCode.SessionID; |
292 | this.CircuitCode = cirpack.CircuitCode.Code; | 253 | this.CircuitCode = cirpack.CircuitCode.Code; |
293 | InitNewClient(); | 254 | InitNewClient(); |
294 | this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; | 255 | //this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; |
295 | this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; | 256 | // this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; |
296 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) | 257 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) |
297 | { | 258 | { |
298 | this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; | 259 | this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; |
299 | } | 260 | } |
300 | 261 | ||
301 | // Create Inventory, currently only works for sandbox mode | ||
302 | if (m_sandboxMode) | ||
303 | { | ||
304 | this.SetupInventory(sessionInfo); | ||
305 | } | ||
306 | |||
307 | ClientLoop(); | 262 | ClientLoop(); |
308 | } | 263 | } |
309 | } | 264 | } |
@@ -318,18 +273,18 @@ namespace OpenSim | |||
318 | #region Inventory Creation | 273 | #region Inventory Creation |
319 | private void SetupInventory(AuthenticateResponse sessionInfo) | 274 | private void SetupInventory(AuthenticateResponse sessionInfo) |
320 | { | 275 | { |
321 | 276 | ||
322 | } | 277 | } |
323 | private AgentInventory CreateInventory(LLUUID baseFolder) | 278 | private AgentInventory CreateInventory(LLUUID baseFolder) |
324 | { | 279 | { |
325 | AgentInventory inventory = null; | 280 | AgentInventory inventory = null; |
326 | 281 | ||
327 | return inventory; | 282 | return inventory; |
328 | } | 283 | } |
329 | 284 | ||
330 | private void CreateInventoryItem(CreateInventoryItemPacket packet) | 285 | private void CreateInventoryItem(CreateInventoryItemPacket packet) |
331 | { | 286 | { |
332 | 287 | ||
333 | } | 288 | } |
334 | #endregion | 289 | #endregion |
335 | 290 | ||