diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 60 | ||||
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Data/GridData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Remoting.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 10 |
8 files changed, 33 insertions, 55 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index abaea23..99356c2 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -36,7 +36,6 @@ using OpenSim.Framework.Console; | |||
36 | 36 | ||
37 | namespace OpenSim.Framework.Communications.Cache | 37 | namespace OpenSim.Framework.Communications.Cache |
38 | { | 38 | { |
39 | |||
40 | public delegate void AssetRequestCallback(LLUUID assetID, AssetBase asset); | 39 | public delegate void AssetRequestCallback(LLUUID assetID, AssetBase asset); |
41 | 40 | ||
42 | /// <summary> | 41 | /// <summary> |
@@ -77,7 +76,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
77 | m_assetCacheThread.IsBackground = true; | 76 | m_assetCacheThread.IsBackground = true; |
78 | m_assetCacheThread.Start(); | 77 | m_assetCacheThread.Start(); |
79 | 78 | ||
80 | |||
81 | m_log = log; | 79 | m_log = log; |
82 | } | 80 | } |
83 | 81 | ||
@@ -100,7 +98,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
100 | } | 98 | } |
101 | } | 99 | } |
102 | 100 | ||
103 | |||
104 | public AssetBase GetAsset(LLUUID assetID) | 101 | public AssetBase GetAsset(LLUUID assetID) |
105 | { | 102 | { |
106 | AssetBase asset = null; | 103 | AssetBase asset = null; |
@@ -154,7 +151,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
154 | } | 151 | } |
155 | } | 152 | } |
156 | 153 | ||
157 | |||
158 | public AssetBase GetAsset(LLUUID assetID, bool isTexture) | 154 | public AssetBase GetAsset(LLUUID assetID, bool isTexture) |
159 | { | 155 | { |
160 | AssetBase asset = GetAsset(assetID); | 156 | AssetBase asset = GetAsset(assetID); |
@@ -236,8 +232,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
236 | return asset; | 232 | return asset; |
237 | } | 233 | } |
238 | 234 | ||
239 | |||
240 | |||
241 | public void AssetReceived(AssetBase asset, bool IsTexture) | 235 | public void AssetReceived(AssetBase asset, bool IsTexture) |
242 | { | 236 | { |
243 | if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server | 237 | if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server |
@@ -249,7 +243,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
249 | 243 | ||
250 | if (IsTexture) | 244 | if (IsTexture) |
251 | { | 245 | { |
252 | //Console.WriteLine("asset recieved from asset server"); | 246 | //Console.WriteLine("asset received from asset server"); |
253 | 247 | ||
254 | TextureImage image = new TextureImage(asset); | 248 | TextureImage image = new TextureImage(asset); |
255 | if (!Textures.ContainsKey(image.FullID)) | 249 | if (!Textures.ContainsKey(image.FullID)) |
@@ -260,7 +254,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
260 | AssetRequest req = RequestedTextures[image.FullID]; | 254 | AssetRequest req = RequestedTextures[image.FullID]; |
261 | req.ImageInfo = image; | 255 | req.ImageInfo = image; |
262 | 256 | ||
263 | req.NumPackets = CalculateNumPackets(image.Data.Length); | 257 | req.NumPackets = CalculateNumPackets(image.Data); |
264 | 258 | ||
265 | RequestedTextures.Remove(image.FullID); | 259 | RequestedTextures.Remove(image.FullID); |
266 | TextureRequests.Add(req); | 260 | TextureRequests.Add(req); |
@@ -277,15 +271,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
277 | { | 271 | { |
278 | AssetRequest req = RequestedAssets[assetInf.FullID]; | 272 | AssetRequest req = RequestedAssets[assetInf.FullID]; |
279 | req.AssetInf = assetInf; | 273 | req.AssetInf = assetInf; |
280 | if (assetInf.Data.LongLength > 600) | 274 | req.NumPackets = CalculateNumPackets(assetInf.Data); |
281 | { | ||
282 | //over 600 bytes so split up file | ||
283 | req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; | ||
284 | } | ||
285 | else | ||
286 | { | ||
287 | req.NumPackets = 1; | ||
288 | } | ||
289 | RequestedAssets.Remove(assetInf.FullID); | 275 | RequestedAssets.Remove(assetInf.FullID); |
290 | AssetRequests.Add(req); | 276 | AssetRequests.Add(req); |
291 | } | 277 | } |
@@ -326,16 +312,17 @@ namespace OpenSim.Framework.Communications.Cache | |||
326 | //} | 312 | //} |
327 | } | 313 | } |
328 | 314 | ||
329 | private int CalculateNumPackets(int length) | 315 | private int CalculateNumPackets(byte[] data) |
330 | { | 316 | { |
317 | const uint m_maxPacketSize = 600; | ||
331 | int numPackets = 1; | 318 | int numPackets = 1; |
332 | 319 | ||
333 | if (length > 600) | 320 | if (data.LongLength > m_maxPacketSize) |
334 | { | 321 | { |
335 | //over 600 bytes so split up file | 322 | // over max number of bytes so split up file |
336 | int restData = (length - 600); | 323 | long restData = data.LongLength - m_maxPacketSize; |
337 | int restPackets = ((restData + 999) / 1000); | 324 | int restPackets = (int) ((restData + m_maxPacketSize - 1) / m_maxPacketSize); |
338 | numPackets = 1 + restPackets; | 325 | numPackets += restPackets; |
339 | } | 326 | } |
340 | 327 | ||
341 | return numPackets; | 328 | return numPackets; |
@@ -385,8 +372,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
385 | //it is in our cache | 372 | //it is in our cache |
386 | AssetInfo asset = Assets[requestID]; | 373 | AssetInfo asset = Assets[requestID]; |
387 | 374 | ||
388 | //work out how many packets it should be sent in | 375 | // add to the AssetRequests list |
389 | // and add to the AssetRequests list | ||
390 | AssetRequest req = new AssetRequest(); | 376 | AssetRequest req = new AssetRequest(); |
391 | req.RequestUser = userInfo; | 377 | req.RequestUser = userInfo; |
392 | req.RequestAssetID = requestID; | 378 | req.RequestAssetID = requestID; |
@@ -394,17 +380,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
394 | req.AssetRequestSource = source; | 380 | req.AssetRequestSource = source; |
395 | req.Params = transferRequest.TransferInfo.Params; | 381 | req.Params = transferRequest.TransferInfo.Params; |
396 | req.AssetInf = asset; | 382 | req.AssetInf = asset; |
397 | 383 | req.NumPackets = CalculateNumPackets(asset.Data); | |
398 | if (asset.Data.LongLength > 600) | ||
399 | { | ||
400 | //over 600 bytes so split up file | ||
401 | req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; | ||
402 | } | ||
403 | else | ||
404 | { | ||
405 | req.NumPackets = 1; | ||
406 | } | ||
407 | |||
408 | AssetRequests.Add(req); | 384 | AssetRequests.Add(req); |
409 | } | 385 | } |
410 | 386 | ||
@@ -419,17 +395,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
419 | //no requests waiting | 395 | //no requests waiting |
420 | return; | 396 | return; |
421 | } | 397 | } |
422 | int num; | 398 | // if less than 5, do all of them |
399 | int num = Math.Min(5, AssetRequests.Count); | ||
423 | 400 | ||
424 | if (AssetRequests.Count < 5) | ||
425 | { | ||
426 | //lower than 5 so do all of them | ||
427 | num = AssetRequests.Count; | ||
428 | } | ||
429 | else | ||
430 | { | ||
431 | num = 5; | ||
432 | } | ||
433 | AssetRequest req; | 401 | AssetRequest req; |
434 | for (int i = 0; i < num; i++) | 402 | for (int i = 0; i < num; i++) |
435 | { | 403 | { |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index 9e5a679..383bfbe 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs | |||
@@ -199,7 +199,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
199 | /// </summary> | 199 | /// </summary> |
200 | /// <remarks>Move to inventory server</remarks> | 200 | /// <remarks>Move to inventory server</remarks> |
201 | /// <param name="from">Senders account</param> | 201 | /// <param name="from">Senders account</param> |
202 | /// <param name="to">Recievers account</param> | 202 | /// <param name="to">Receivers account</param> |
203 | /// <param name="item">Inventory item</param> | 203 | /// <param name="item">Inventory item</param> |
204 | /// <returns>Success?</returns> | 204 | /// <returns>Success?</returns> |
205 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | 205 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) |
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs index 80b65c1..ccab57b 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs | |||
@@ -387,7 +387,7 @@ namespace OpenSim.Framework.Data.MSSQL | |||
387 | /// Performs a money transfer request between two accounts | 387 | /// Performs a money transfer request between two accounts |
388 | /// </summary> | 388 | /// </summary> |
389 | /// <param name="from">The senders account ID</param> | 389 | /// <param name="from">The senders account ID</param> |
390 | /// <param name="to">The recievers account ID</param> | 390 | /// <param name="to">The receivers account ID</param> |
391 | /// <param name="amount">The amount to transfer</param> | 391 | /// <param name="amount">The amount to transfer</param> |
392 | /// <returns>Success?</returns> | 392 | /// <returns>Success?</returns> |
393 | public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) | 393 | public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) |
@@ -400,7 +400,7 @@ namespace OpenSim.Framework.Data.MSSQL | |||
400 | /// </summary> | 400 | /// </summary> |
401 | /// <remarks>TODO: Move to inventory server</remarks> | 401 | /// <remarks>TODO: Move to inventory server</remarks> |
402 | /// <param name="from">The senders account ID</param> | 402 | /// <param name="from">The senders account ID</param> |
403 | /// <param name="to">The recievers account ID</param> | 403 | /// <param name="to">The receivers account ID</param> |
404 | /// <param name="item">The item to transfer</param> | 404 | /// <param name="item">The item to transfer</param> |
405 | /// <returns>Success?</returns> | 405 | /// <returns>Success?</returns> |
406 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | 406 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 6a7cf49..05e5127 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs | |||
@@ -363,7 +363,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
363 | /// Performs a money transfer request between two accounts | 363 | /// Performs a money transfer request between two accounts |
364 | /// </summary> | 364 | /// </summary> |
365 | /// <param name="from">The senders account ID</param> | 365 | /// <param name="from">The senders account ID</param> |
366 | /// <param name="to">The recievers account ID</param> | 366 | /// <param name="to">The receivers account ID</param> |
367 | /// <param name="amount">The amount to transfer</param> | 367 | /// <param name="amount">The amount to transfer</param> |
368 | /// <returns>Success?</returns> | 368 | /// <returns>Success?</returns> |
369 | public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) | 369 | public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) |
@@ -376,7 +376,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
376 | /// </summary> | 376 | /// </summary> |
377 | /// <remarks>TODO: Move to inventory server</remarks> | 377 | /// <remarks>TODO: Move to inventory server</remarks> |
378 | /// <param name="from">The senders account ID</param> | 378 | /// <param name="from">The senders account ID</param> |
379 | /// <param name="to">The recievers account ID</param> | 379 | /// <param name="to">The receivers account ID</param> |
380 | /// <param name="item">The item to transfer</param> | 380 | /// <param name="item">The item to transfer</param> |
381 | /// <returns>Success?</returns> | 381 | /// <returns>Success?</returns> |
382 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | 382 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index 346febc..99121be 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | |||
@@ -320,7 +320,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
320 | /// </summary> | 320 | /// </summary> |
321 | /// <remarks>Move to inventory server</remarks> | 321 | /// <remarks>Move to inventory server</remarks> |
322 | /// <param name="from">Senders account</param> | 322 | /// <param name="from">Senders account</param> |
323 | /// <param name="to">Recievers account</param> | 323 | /// <param name="to">Receivers account</param> |
324 | /// <param name="item">Inventory item</param> | 324 | /// <param name="item">Inventory item</param> |
325 | /// <returns>Success?</returns> | 325 | /// <returns>Success?</returns> |
326 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | 326 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) |
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs index 1aebbda..7864dda 100644 --- a/OpenSim/Framework/Data/GridData.cs +++ b/OpenSim/Framework/Data/GridData.cs | |||
@@ -79,12 +79,12 @@ namespace OpenSim.Framework.Data | |||
79 | 79 | ||
80 | List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); | 80 | List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); |
81 | /// <summary> | 81 | /// <summary> |
82 | /// Authenticates a sim by use of it's recv key. | 82 | /// Authenticates a sim by use of its recv key. |
83 | /// WARNING: Insecure | 83 | /// WARNING: Insecure |
84 | /// </summary> | 84 | /// </summary> |
85 | /// <param name="UUID">The UUID sent by the sim</param> | 85 | /// <param name="UUID">The UUID sent by the sim</param> |
86 | /// <param name="regionHandle">The regionhandle sent by the sim</param> | 86 | /// <param name="regionHandle">The regionhandle sent by the sim</param> |
87 | /// <param name="simrecvkey">The recieving key sent by the sim</param> | 87 | /// <param name="simrecvkey">The receiving key sent by the sim</param> |
88 | /// <returns>Whether the sim has been authenticated</returns> | 88 | /// <returns>Whether the sim has been authenticated</returns> |
89 | bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey); | 89 | bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey); |
90 | 90 | ||
diff --git a/OpenSim/Framework/Remoting.cs b/OpenSim/Framework/Remoting.cs index aa7e947..9cf0d11 100644 --- a/OpenSim/Framework/Remoting.cs +++ b/OpenSim/Framework/Remoting.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Framework | |||
38 | /// Suggested implementation | 38 | /// Suggested implementation |
39 | /// <para>Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.</para> | 39 | /// <para>Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.</para> |
40 | /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para> | 40 | /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para> |
41 | /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para> | 41 | /// <para>When receiving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para> |
42 | /// <para>Both hosts should be performing these operations for this to be effective.</para> | 42 | /// <para>Both hosts should be performing these operations for this to be effective.</para> |
43 | /// </remarks> | 43 | /// </remarks> |
44 | internal class RemoteDigest | 44 | internal class RemoteDigest |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a8eef51..740f527 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -373,5 +373,15 @@ namespace OpenSim.Framework | |||
373 | config.Configs[(string) row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); | 373 | config.Configs[(string) row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); |
374 | } | 374 | } |
375 | } | 375 | } |
376 | |||
377 | public static float Clip(float x, float min, float max) | ||
378 | { | ||
379 | return Math.Min(Math.Max(x, min), max); | ||
380 | } | ||
381 | |||
382 | public static int Clip(int x, int min, int max) | ||
383 | { | ||
384 | return Math.Min(Math.Max(x, min), max); | ||
385 | } | ||
376 | } | 386 | } |
377 | } | 387 | } |