aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2008-05-19 19:08:59 +0000
committerSean Dague2008-05-19 19:08:59 +0000
commit9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9 (patch)
treec823e351a3796d145bc71aee402c18cb89b8fb25 /OpenSim
parent(from awebb) (diff)
downloadopensim-SC-9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9.zip
opensim-SC-9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9.tar.gz
opensim-SC-9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9.tar.bz2
opensim-SC-9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9.tar.xz
i can haz pantz?
You sure can. This change set restores pants (and the rest of the default appearance) in grid mode. The root issue had to do with serializing multi-faced textures to the grid server. This also restores the lookup path through the avatar factory module, as that seems the reasonable place to have it live. Some clean up patches are coming later as well, plus testing on standalone, but this should be in a good kicking around state for grid users.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs4
-rw-r--r--OpenSim/Data/UserDataBase.cs7
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs2
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs31
-rw-r--r--OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs204
6 files changed, 129 insertions, 127 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index 677d287..cd5ac39 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -661,9 +661,7 @@ namespace OpenSim.Data.MySQL
661 AvatarAppearance appearance = null; 661 AvatarAppearance appearance = null;
662 if (!m_appearanceMapper.TryGetValue(user.UUID, out appearance)) 662 if (!m_appearanceMapper.TryGetValue(user.UUID, out appearance))
663 { 663 {
664 appearance = new AvatarAppearance(); 664 appearance = null;
665 appearance.Owner = user;
666 UpdateUserAppearance(user, appearance);
667 } 665 }
668 return appearance; 666 return appearance;
669 } 667 }
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs
index 50325b2..57f4564 100644
--- a/OpenSim/Data/UserDataBase.cs
+++ b/OpenSim/Data/UserDataBase.cs
@@ -60,15 +60,12 @@ namespace OpenSim.Data
60 public abstract void Initialise(string connect); 60 public abstract void Initialise(string connect);
61 public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); 61 public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
62 public AvatarAppearance GetUserAppearance(LLUUID user) { 62 public AvatarAppearance GetUserAppearance(LLUUID user) {
63 AvatarAppearance aa; 63 AvatarAppearance aa = null;
64 try { 64 try {
65 aa = aplist[user]; 65 aa = aplist[user];
66 m_log.Info("[APPEARANCE] Found appearance for " + user.ToString() + aa.ToString()); 66 m_log.Info("[APPEARANCE] Found appearance for " + user.ToString() + aa.ToString());
67 } catch (System.Collections.Generic.KeyNotFoundException e) { 67 } catch (System.Collections.Generic.KeyNotFoundException e) {
68 aplist[user] = new AvatarAppearance(); 68 m_log.Info("[APPEARANCE] No appearance found for " + user.ToString());
69 aplist[user].Owner = user;
70 aa = aplist[user];
71 m_log.Info("[APPEARANCE] Setting up default appearance for " + user.ToString() + aa.ToString());
72 } 69 }
73 return aa; 70 return aa;
74 } 71 }
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 5a62682..87e06f1 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -611,7 +611,7 @@ namespace OpenSim.Framework.Communications
611 m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString()); 611 m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString());
612 } 612 }
613 } 613 }
614 return new AvatarAppearance(); 614 return null;
615 } 615 }
616 616
617 public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) 617 public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 307af34..1cf2a48 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -256,7 +256,13 @@ namespace OpenSim.Grid.UserServer
256 if (requestData.Contains("owner")) 256 if (requestData.Contains("owner"))
257 { 257 {
258 appearance = GetUserAppearance(new LLUUID((string)requestData["owner"])); 258 appearance = GetUserAppearance(new LLUUID((string)requestData["owner"]));
259 responseData = appearance.ToHashTable(); 259 if (appearance == null) {
260 responseData = new Hashtable();
261 responseData["error_type"] = "no appearance";
262 responseData["error_desc"] = "There was no appearance found for this avatar";
263 } else {
264 responseData = appearance.ToHashTable();
265 }
260 } 266 }
261 else 267 else
262 { 268 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e1764b5..d02d22f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1780,28 +1780,27 @@ namespace OpenSim.Region.Environment.Scenes
1780 1780
1781 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) 1781 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
1782 { 1782 {
1783 AvatarAppearance appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); 1783
1784 AvatarAppearance appearance = null;
1785 GetAvatarAppearance(client, out appearance);
1784 1786
1785 ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance); 1787 ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance);
1786 1788
1787 return avatar; 1789 return avatar;
1788 } 1790 }
1789 1791
1790 // protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) 1792 protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
1791 // { 1793 {
1792 // appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); 1794 appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
1793 1795
1794 // // if (m_AvatarFactory == null || 1796 if (m_AvatarFactory == null ||
1795 // // !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) 1797 !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
1796 // // { 1798 {
1797 // // //not found Appearance 1799 // not found Appearance
1798 // // m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis"); 1800 m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis");
1799 // // byte[] visualParams; 1801 appearance = new AvatarAppearance();
1800 // // AvatarWearable[] wearables; 1802 }
1801 // // GetDefaultAvatarAppearance(out wearables, out visualParams); 1803 }
1802 // // appearance = new AvatarAppearance(client.AgentId, wearables, visualParams);
1803 // // }
1804 // }
1805 1804
1806 /// <summary> 1805 /// <summary>
1807 /// Remove the given client from the scene. 1806 /// Remove the given client from the scene.
diff --git a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs
index 3ac8e9a..7dae702 100644
--- a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs
@@ -59,112 +59,114 @@ namespace OpenSim.Region.Modules.AvatarFactory
59 59
60 public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) 60 public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance)
61 { 61 {
62 appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId);
63 return true;
62 64
63 //should only let one thread at a time do this part 65 // //should only let one thread at a time do this part
64 EventWaitHandle waitHandle = null; 66 // EventWaitHandle waitHandle = null;
65 bool fetchInProgress = false; 67 // bool fetchInProgress = false;
66 lock (m_syncLock) 68 // lock (m_syncLock)
67 { 69 // {
68 appearance = CheckCache(avatarId); 70 // appearance = CheckCache(avatarId);
69 if (appearance != null) 71 // if (appearance != null)
70 { 72 // {
71 return true; 73 // return true;
72 } 74 // }
73
74 //not in cache so check to see if another thread is already fetching it
75 if (m_fetchesInProgress.TryGetValue(avatarId, out waitHandle))
76 {
77 fetchInProgress = true;
78 }
79 else
80 {
81 fetchInProgress = false;
82
83 //no thread already fetching this appearance, so add a wait handle to list
84 //for any following threads that want the same appearance
85 waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
86 m_fetchesInProgress.Add(avatarId, waitHandle);
87 }
88 }
89 75
90 if (fetchInProgress) 76 // //not in cache so check to see if another thread is already fetching it
91 { 77 // if (m_fetchesInProgress.TryGetValue(avatarId, out waitHandle))
92 waitHandle.WaitOne(); 78 // {
93 appearance = CheckCache(avatarId); 79 // fetchInProgress = true;
94 if (appearance != null) 80 // }
95 { 81 // else
96 waitHandle = null; 82 // {
97 return true; 83 // fetchInProgress = false;
98 }
99 else
100 {
101 waitHandle = null;
102 return false;
103 }
104 }
105 else
106 {
107 // BUG: !? (Reduced from 5000 to 500 by Adam)
108 Thread.Sleep(500); //why is this here?
109
110 //this is the first thread to request this appearance
111 //so let it check the db and if not found then create a default appearance
112 //and add that to the cache
113 appearance = CheckDatabase(avatarId);
114 if (appearance != null)
115 {
116 //appearance has now been added to cache so lets pulse any waiting threads
117 lock (m_syncLock)
118 {
119 m_fetchesInProgress.Remove(avatarId);
120 waitHandle.Set();
121 }
122 // waitHandle.Close();
123 waitHandle = null;
124 return true;
125 }
126 84
127 //not found a appearance for the user, so create a new default one 85 // //no thread already fetching this appearance, so add a wait handle to list
128 appearance = CreateDefault(avatarId); 86 // //for any following threads that want the same appearance
129 if (appearance != null) 87 // waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
130 { 88 // m_fetchesInProgress.Add(avatarId, waitHandle);
131 //update database 89 // }
132 if (m_enablePersist) 90 // }
133 {
134 m_appearanceMapper.Add(avatarId.UUID, appearance);
135 }
136 91
137 //add appearance to dictionary cache 92 // if (fetchInProgress)
138 lock (m_avatarsAppearance) 93 // {
139 { 94 // waitHandle.WaitOne();
140 m_avatarsAppearance[avatarId] = appearance; 95 // appearance = CheckCache(avatarId);
141 } 96 // if (appearance != null)
97 // {
98 // waitHandle = null;
99 // return true;
100 // }
101 // else
102 // {
103 // waitHandle = null;
104 // return false;
105 // }
106 // }
107 // else
108 // {
109 // // BUG: !? (Reduced from 5000 to 500 by Adam)
110 // Thread.Sleep(500); //why is this here?
111
112 // //this is the first thread to request this appearance
113 // //so let it check the db and if not found then create a default appearance
114 // //and add that to the cache
115 // appearance = CheckDatabase(avatarId);
116 // if (appearance != null)
117 // {
118 // //appearance has now been added to cache so lets pulse any waiting threads
119 // lock (m_syncLock)
120 // {
121 // m_fetchesInProgress.Remove(avatarId);
122 // waitHandle.Set();
123 // }
124 // // waitHandle.Close();
125 // waitHandle = null;
126 // return true;
127 // }
142 128
143 //appearance has now been added to cache so lets pulse any waiting threads 129 // //not found a appearance for the user, so create a new default one
144 lock (m_syncLock) 130 // appearance = CreateDefault(avatarId);
145 { 131 // if (appearance != null)
146 m_fetchesInProgress.Remove(avatarId); 132 // {
147 waitHandle.Set(); 133 // //update database
148 } 134 // if (m_enablePersist)
149 // waitHandle.Close(); 135 // {
150 waitHandle = null; 136 // m_appearanceMapper.Add(avatarId.UUID, appearance);
151 return true; 137 // }
152 } 138
153 else 139 // //add appearance to dictionary cache
154 { 140 // lock (m_avatarsAppearance)
155 //something went wrong, so release the wait handle and remove it 141 // {
156 //all waiting threads will fail to find cached appearance 142 // m_avatarsAppearance[avatarId] = appearance;
157 //but its better for them to fail than wait for ever 143 // }
158 lock (m_syncLock) 144
159 { 145 // //appearance has now been added to cache so lets pulse any waiting threads
160 m_fetchesInProgress.Remove(avatarId); 146 // lock (m_syncLock)
161 waitHandle.Set(); 147 // {
162 } 148 // m_fetchesInProgress.Remove(avatarId);
163 //waitHandle.Close(); 149 // waitHandle.Set();
164 waitHandle = null; 150 // }
165 return false; 151 // // waitHandle.Close();
166 } 152 // waitHandle = null;
167 } 153 // return true;
154 // }
155 // else
156 // {
157 // //something went wrong, so release the wait handle and remove it
158 // //all waiting threads will fail to find cached appearance
159 // //but its better for them to fail than wait for ever
160 // lock (m_syncLock)
161 // {
162 // m_fetchesInProgress.Remove(avatarId);
163 // waitHandle.Set();
164 // }
165 // //waitHandle.Close();
166 // waitHandle = null;
167 // return false;
168 // }
169 // }
168 } 170 }
169 171
170 private AvatarAppearance CreateDefault(LLUUID avatarId) 172 private AvatarAppearance CreateDefault(LLUUID avatarId)