diff options
-rw-r--r-- | OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 622780a..7ac7917 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -446,35 +446,42 @@ namespace OpenSim.Services.Connectors | |||
446 | return exist; | 446 | return exist; |
447 | } | 447 | } |
448 | 448 | ||
449 | string stringUUIDZero = UUID.Zero.ToString(); | ||
450 | |||
449 | public string Store(AssetBase asset) | 451 | public string Store(AssetBase asset) |
450 | { | 452 | { |
451 | // Have to assign the asset ID here. This isn't likely to | 453 | // Have to assign the asset ID here. This isn't likely to |
452 | // trigger since current callers don't pass emtpy IDs | 454 | // trigger since current callers don't pass emtpy IDs |
453 | // We need the asset ID to route the request to the proper | 455 | // We need the asset ID to route the request to the proper |
454 | // cluster member, so we can't have the server assign one. | 456 | // cluster member, so we can't have the server assign one. |
455 | if (asset.ID == string.Empty) | 457 | if (asset.ID == string.Empty || asset.ID == stringUUIDZero) |
456 | { | 458 | { |
457 | if (asset.FullID == UUID.Zero) | 459 | if (asset.FullID == UUID.Zero) |
458 | { | 460 | { |
459 | asset.FullID = UUID.Random(); | 461 | asset.FullID = UUID.Random(); |
460 | } | 462 | } |
463 | m_log.WarnFormat("[Assets] Zero ID: {0}",asset.Name); | ||
461 | asset.ID = asset.FullID.ToString(); | 464 | asset.ID = asset.FullID.ToString(); |
462 | } | 465 | } |
463 | else if (asset.FullID == UUID.Zero) | 466 | |
467 | if (asset.FullID == UUID.Zero) | ||
464 | { | 468 | { |
465 | UUID uuid = UUID.Zero; | 469 | UUID uuid = UUID.Zero; |
466 | if (UUID.TryParse(asset.ID, out uuid)) | 470 | if (UUID.TryParse(asset.ID, out uuid)) |
467 | { | 471 | { |
468 | asset.FullID = uuid; | 472 | asset.FullID = uuid; |
469 | } | 473 | } |
470 | else | 474 | if(asset.FullID == UUID.Zero) |
471 | { | 475 | { |
476 | m_log.WarnFormat("[Assets] Zero IDs: {0}",asset.Name); | ||
472 | asset.FullID = UUID.Random(); | 477 | asset.FullID = UUID.Random(); |
478 | asset.ID = asset.FullID.ToString(); | ||
473 | } | 479 | } |
474 | } | 480 | } |
475 | 481 | ||
476 | if (m_Cache != null) | 482 | if (m_Cache != null) |
477 | m_Cache.Cache(asset); | 483 | m_Cache.Cache(asset); |
484 | |||
478 | if (asset.Temporary || asset.Local) | 485 | if (asset.Temporary || asset.Local) |
479 | { | 486 | { |
480 | return asset.ID; | 487 | return asset.ID; |
@@ -482,22 +489,15 @@ namespace OpenSim.Services.Connectors | |||
482 | 489 | ||
483 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; | 490 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; |
484 | 491 | ||
485 | string newID; | 492 | string newID = null; |
486 | try | 493 | try |
487 | { | 494 | { |
488 | newID = SynchronousRestObjectRequester. | 495 | newID = SynchronousRestObjectRequester. |
489 | MakeRequest<AssetBase, string>("POST", uri, asset, 100000, m_Auth); | 496 | MakeRequest<AssetBase, string>("POST", uri, asset, 100000, m_Auth); |
490 | if (newID == null || newID == "") | ||
491 | { | ||
492 | newID = UUID.Zero.ToString(); | ||
493 | } | ||
494 | } | ||
495 | catch (Exception e) | ||
496 | { | ||
497 | newID = UUID.Zero.ToString(); | ||
498 | } | 497 | } |
498 | catch {} | ||
499 | 499 | ||
500 | if (newID == UUID.Zero.ToString()) | 500 | if (newID == null || newID == String.Empty || newID == stringUUIDZero) |
501 | { | 501 | { |
502 | //The asset upload failed, put it in a queue for later | 502 | //The asset upload failed, put it in a queue for later |
503 | asset.UploadAttempts++; | 503 | asset.UploadAttempts++; |
@@ -525,13 +525,13 @@ namespace OpenSim.Services.Connectors | |||
525 | { | 525 | { |
526 | m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString()); | 526 | m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString()); |
527 | } | 527 | } |
528 | if (newID != String.Empty) | 528 | if (newID != asset.ID) |
529 | { | 529 | { |
530 | // Placing this here, so that this work with old asset servers that don't send any reply back | 530 | // Placing this here, so that this work with old asset servers that don't send any reply back |
531 | // SynchronousRestObjectRequester returns somethins that is not an empty string | 531 | // SynchronousRestObjectRequester returns somethins that is not an empty string |
532 | if (newID != null) | ||
533 | asset.ID = newID; | ||
534 | 532 | ||
533 | asset.ID = newID; | ||
534 | // what about FullID ???? | ||
535 | if (m_Cache != null) | 535 | if (m_Cache != null) |
536 | m_Cache.Cache(asset); | 536 | m_Cache.Cache(asset); |
537 | } | 537 | } |