diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 48 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 7 |
5 files changed, 84 insertions, 35 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index d1ff9c9..4765548 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -156,16 +156,58 @@ namespace OpenSim.Framework.Communications.Cache | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | /// <summary> | ||
160 | /// Get an asset. If the asset isn't in the cache, a request will be made to the persistent store to | ||
161 | /// load it into the cache. | ||
162 | /// | ||
163 | /// XXX We'll keep polling the cache until we get the asset or we exceed | ||
164 | /// the allowed number of polls. This isn't a very good way of doing things since a single thread | ||
165 | /// is processing inbound packets, so if the asset server is slow, we could block this for up to | ||
166 | /// the timeout period. What we might want to do is register asynchronous callbacks on asset | ||
167 | /// receipt in the same manner as the nascent (but not yet active) TextureDownloadModule. Of course, | ||
168 | /// a timeout before asset receipt usually isn't fatal, the operation will work on the retry when the | ||
169 | /// asset is much more likely to have made it into the cache. | ||
170 | /// </summary> | ||
171 | /// <param name="assetID"></param> | ||
172 | /// <param name="isTexture"></param> | ||
173 | /// <returns>null if the asset could not be retrieved</returns> | ||
159 | public AssetBase GetAsset(LLUUID assetID, bool isTexture) | 174 | public AssetBase GetAsset(LLUUID assetID, bool isTexture) |
160 | { | 175 | { |
176 | // I'm not going over 3 seconds since this will be blocking processing of all the other inbound | ||
177 | // packets from the client. | ||
178 | int pollPeriod = 200; | ||
179 | int maxPolls = 15; | ||
180 | |||
161 | AssetBase asset = GetCachedAsset(assetID); | 181 | AssetBase asset = GetCachedAsset(assetID); |
162 | if (asset == null) | 182 | if (asset != null) |
163 | { | 183 | { |
164 | m_assetServer.RequestAsset(assetID, isTexture); | 184 | return asset; |
165 | } | 185 | } |
166 | return asset; | 186 | |
187 | m_assetServer.RequestAsset(assetID, isTexture); | ||
188 | |||
189 | do | ||
190 | { | ||
191 | Thread.Sleep(pollPeriod); | ||
192 | |||
193 | asset = GetCachedAsset(assetID); | ||
194 | if (asset != null) | ||
195 | { | ||
196 | return asset; | ||
197 | } | ||
198 | } | ||
199 | while (--maxPolls > 0); | ||
200 | |||
201 | MainLog.Instance.Warn( | ||
202 | "ASSETCACHE", "Asset {0} was not received before the retrieval timeout was reached"); | ||
203 | |||
204 | return null; | ||
167 | } | 205 | } |
168 | 206 | ||
207 | /// <summary> | ||
208 | /// Add an asset to both the persistent store and the cache. | ||
209 | /// </summary> | ||
210 | /// <param name="asset"></param> | ||
169 | public void AddAsset(AssetBase asset) | 211 | public void AddAsset(AssetBase asset) |
170 | { | 212 | { |
171 | string temporary = asset.Temporary ? "temporary" : ""; | 213 | string temporary = asset.Temporary ? "temporary" : ""; |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8ba161a..18ecd92 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -473,8 +473,6 @@ namespace OpenSim.Framework | |||
473 | event RegionInfoRequest OnRegionInfoRequest; | 473 | event RegionInfoRequest OnRegionInfoRequest; |
474 | event EstateCovenantRequest OnEstateCovenantRequest; | 474 | event EstateCovenantRequest OnEstateCovenantRequest; |
475 | 475 | ||
476 | |||
477 | |||
478 | LLVector3 StartPos { get; set; } | 476 | LLVector3 StartPos { get; set; } |
479 | 477 | ||
480 | LLUUID AgentId { get; } | 478 | LLUUID AgentId { get; } |
@@ -486,6 +484,13 @@ namespace OpenSim.Framework | |||
486 | string FirstName { get; } | 484 | string FirstName { get; } |
487 | 485 | ||
488 | string LastName { get; } | 486 | string LastName { get; } |
487 | |||
488 | /// <summary> | ||
489 | /// Returns the full name of the agent/avatar represented by this client | ||
490 | /// </summary> | ||
491 | /// <param name="newPack"></param> | ||
492 | /// <param name="packType"></param> | ||
493 | string Name { get; } | ||
489 | 494 | ||
490 | uint CircuitCode { get; } | 495 | uint CircuitCode { get; } |
491 | 496 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 34a9b09..9e695ea 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack | |||
130 | } | 130 | } |
131 | 131 | ||
132 | /// <summary> | 132 | /// <summary> |
133 | /// | 133 | /// First name of the agent/avatar represented by the client |
134 | /// </summary> | 134 | /// </summary> |
135 | public string FirstName | 135 | public string FirstName |
136 | { | 136 | { |
@@ -138,12 +138,20 @@ namespace OpenSim.Region.ClientStack | |||
138 | } | 138 | } |
139 | 139 | ||
140 | /// <summary> | 140 | /// <summary> |
141 | /// | 141 | /// Last name of the agent/avatar represented by the client |
142 | /// </summary> | 142 | /// </summary> |
143 | public string LastName | 143 | public string LastName |
144 | { | 144 | { |
145 | get { return m_lastName; } | 145 | get { return m_lastName; } |
146 | } | 146 | } |
147 | |||
148 | /// <summary> | ||
149 | /// Full name of the client (first name and last name) | ||
150 | /// </summary> | ||
151 | public string Name | ||
152 | { | ||
153 | get { return FirstName + " " + LastName; } | ||
154 | } | ||
147 | 155 | ||
148 | public uint CircuitCode | 156 | public uint CircuitCode |
149 | { | 157 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index efd96d2..2d0ffd8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -429,16 +429,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
429 | //group.AddInventoryItem(rmoteClient, primLocalID, null); | 429 | //group.AddInventoryItem(rmoteClient, primLocalID, null); |
430 | MainLog.Instance.Verbose( | 430 | MainLog.Instance.Verbose( |
431 | "PRIMINVENTORY", | 431 | "PRIMINVENTORY", |
432 | "UpdateTaskInventory called with item {0}, folder {1}, primLocalID {2}", | 432 | "UpdateTaskInventory called with script {0}, folder {1}, primLocalID {2}, user {3}", |
433 | itemID, folderID, primLocalID); | 433 | itemID, folderID, primLocalID, remoteClient.Name); |
434 | } | 434 | } |
435 | else | 435 | else |
436 | { | 436 | { |
437 | MainLog.Instance.Warn( | 437 | MainLog.Instance.Warn( |
438 | "PRIMINVENTORY", | 438 | "PRIMINVENTORY", |
439 | "Update with item {0} requested of prim {1} but this prim does not exist", | 439 | "Update with script {0} requested of prim {1} for {2} but this prim does not exist", |
440 | itemID, | 440 | itemID, primLocalID, remoteClient.Name); |
441 | primLocalID); | ||
442 | } | 441 | } |
443 | } | 442 | } |
444 | 443 | ||
@@ -465,14 +464,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
465 | { | 464 | { |
466 | isTexture = true; | 465 | isTexture = true; |
467 | } | 466 | } |
467 | |||
468 | AssetBase rezAsset = AssetCache.GetAsset(item.assetID, isTexture); | 468 | AssetBase rezAsset = AssetCache.GetAsset(item.assetID, isTexture); |
469 | 469 | ||
470 | if (rezAsset == null) | ||
471 | { | ||
472 | // lets try once more in case the asset cache is being slow getting the asset from server | ||
473 | rezAsset = AssetCache.GetAsset(item.assetID, isTexture); | ||
474 | } | ||
475 | |||
476 | if (rezAsset != null) | 470 | if (rezAsset != null) |
477 | { | 471 | { |
478 | string script = Util.FieldToString(rezAsset.Data); | 472 | string script = Util.FieldToString(rezAsset.Data); |
@@ -489,32 +483,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
489 | // TODO: do we care about the value of this bool? | 483 | // TODO: do we care about the value of this bool? |
490 | group.AddInventoryItem(remoteClient, localID, item, copyID); | 484 | group.AddInventoryItem(remoteClient, localID, item, copyID); |
491 | group.GetProperites(remoteClient); | 485 | group.GetProperites(remoteClient); |
486 | |||
487 | MainLog.Instance.Verbose( | ||
488 | "PRIMINVENTORY", | ||
489 | "Rezzed script {0} (asset {1}) into prim {2} for user {3}", | ||
490 | item.inventoryName, rezAsset.FullID, localID, remoteClient.Name); | ||
492 | } | 491 | } |
493 | else | 492 | else |
494 | { | 493 | { |
495 | MainLog.Instance.Warn( | 494 | MainLog.Instance.Warn( |
496 | "PRIMINVENTORY", | 495 | "PRIMINVENTORY", |
497 | "Could not rez item {0} into prim {1}" | 496 | "Could not rez script {0} into prim {1} for user {2}" |
498 | + " because the prim could not be found in the region!", | 497 | + " because the prim could not be found in the region!", |
499 | item.inventoryName, | 498 | item.inventoryName, localID, remoteClient.Name); |
500 | localID); | ||
501 | } | 499 | } |
502 | } | 500 | } |
503 | else | 501 | else |
504 | { | 502 | { |
505 | MainLog.Instance.Warn( | 503 | MainLog.Instance.Warn( |
506 | "PRIMINVENTORY", | 504 | "PRIMINVENTORY", |
507 | "Could not rez item {0} into prim {1}" | 505 | "Could not rez script {0} into prim {1} for user {2}" |
508 | + " because the item asset {2} could not be found!", | 506 | + " because the item asset {3} could not be found!", |
509 | item.inventoryName, | 507 | item.inventoryName, localID, item.assetID, remoteClient.Name); |
510 | localID, | ||
511 | item.assetID); | ||
512 | } | 508 | } |
513 | } | 509 | } |
514 | else | 510 | else |
515 | { | 511 | { |
516 | MainLog.Instance.Warn( | 512 | MainLog.Instance.Warn( |
517 | "PRIMINVENTORY", "Could not find script inventory item {0} to rez!", itemID); | 513 | "PRIMINVENTORY", "Could not find script inventory item {0} to rez for {1}!", |
514 | itemID, remoteClient.Name); | ||
518 | } | 515 | } |
519 | } | 516 | } |
520 | } | 517 | } |
@@ -625,12 +622,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
625 | { | 622 | { |
626 | AssetBase rezAsset = AssetCache.GetAsset(item.assetID, false); | 623 | AssetBase rezAsset = AssetCache.GetAsset(item.assetID, false); |
627 | 624 | ||
628 | if (rezAsset == null) | ||
629 | { | ||
630 | // lets try once more in case the asset cache is being slow getting the asset from server | ||
631 | rezAsset = AssetCache.GetAsset(item.assetID, false); | ||
632 | } | ||
633 | |||
634 | if (rezAsset != null) | 625 | if (rezAsset != null) |
635 | { | 626 | { |
636 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 627 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index b31784e..ec93362 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -185,6 +185,11 @@ namespace SimpleApp | |||
185 | { | 185 | { |
186 | get { return lastName; } | 186 | get { return lastName; } |
187 | } | 187 | } |
188 | |||
189 | public virtual String Name | ||
190 | { | ||
191 | get { return FirstName + LastName; } | ||
192 | } | ||
188 | 193 | ||
189 | 194 | ||
190 | public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType) | 195 | public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType) |
@@ -394,8 +399,6 @@ namespace SimpleApp | |||
394 | 399 | ||
395 | private void Update() | 400 | private void Update() |
396 | { | 401 | { |
397 | Encoding enc = Encoding.ASCII; | ||
398 | |||
399 | if (OnAgentUpdate != null) | 402 | if (OnAgentUpdate != null) |
400 | { | 403 | { |
401 | AgentUpdatePacket pack = new AgentUpdatePacket(); | 404 | AgentUpdatePacket pack = new AgentUpdatePacket(); |