diff options
author | Diva Canto | 2013-05-28 20:59:25 -0700 |
---|---|---|
committer | Diva Canto | 2013-05-28 20:59:25 -0700 |
commit | 7e1c7f54c719910145a88bfebf16435b9f142901 (patch) | |
tree | 5871ddf0c55d5769c3e95c2aaa2991b21f3edfca /OpenSim/Region/OptionalModules/Avatar/Voice | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-7e1c7f54c719910145a88bfebf16435b9f142901.zip opensim-SC_OLD-7e1c7f54c719910145a88bfebf16435b9f142901.tar.gz opensim-SC_OLD-7e1c7f54c719910145a88bfebf16435b9f142901.tar.bz2 opensim-SC_OLD-7e1c7f54c719910145a88bfebf16435b9f142901.tar.xz |
First change in Vivox for ages! -- added a lock to serialize calls to vivox servers. This may ameliorate things when lots of avies arrive in a sim at about the same time. Turns out that there are 4 http requests per avie to Vivox.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index cb69411..db4869d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | |||
@@ -117,6 +117,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
117 | 117 | ||
118 | private IConfig m_config; | 118 | private IConfig m_config; |
119 | 119 | ||
120 | private object m_Lock; | ||
121 | |||
120 | public void Initialise(IConfigSource config) | 122 | public void Initialise(IConfigSource config) |
121 | { | 123 | { |
122 | 124 | ||
@@ -128,6 +130,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
128 | if (!m_config.GetBoolean("enabled", false)) | 130 | if (!m_config.GetBoolean("enabled", false)) |
129 | return; | 131 | return; |
130 | 132 | ||
133 | m_Lock = new object(); | ||
134 | |||
131 | try | 135 | try |
132 | { | 136 | { |
133 | // retrieve configuration variables | 137 | // retrieve configuration variables |
@@ -1111,25 +1115,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1111 | 1115 | ||
1112 | doc = new XmlDocument(); | 1116 | doc = new XmlDocument(); |
1113 | 1117 | ||
1114 | try | 1118 | // Let's serialize all calls to Vivox. Most of these are driven by |
1119 | // the clients (CAPs), when the user arrives at the region. We don't | ||
1120 | // want to issue many simultaneous http requests to Vivox, because mono | ||
1121 | // doesn't like that | ||
1122 | lock (m_Lock) | ||
1115 | { | 1123 | { |
1116 | // Otherwise prepare the request | 1124 | try |
1117 | m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); | 1125 | { |
1126 | // Otherwise prepare the request | ||
1127 | m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); | ||
1118 | 1128 | ||
1119 | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); | 1129 | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); |
1120 | 1130 | ||
1121 | // We are sending just parameters, no content | 1131 | // We are sending just parameters, no content |
1122 | req.ContentLength = 0; | 1132 | req.ContentLength = 0; |
1123 | 1133 | ||
1124 | // Send request and retrieve the response | 1134 | // Send request and retrieve the response |
1125 | using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse()) | 1135 | using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse()) |
1126 | using (Stream s = rsp.GetResponseStream()) | 1136 | using (Stream s = rsp.GetResponseStream()) |
1127 | using (XmlTextReader rdr = new XmlTextReader(s)) | 1137 | using (XmlTextReader rdr = new XmlTextReader(s)) |
1128 | doc.Load(rdr); | 1138 | doc.Load(rdr); |
1129 | } | 1139 | } |
1130 | catch (Exception e) | 1140 | catch (Exception e) |
1131 | { | 1141 | { |
1132 | m_log.ErrorFormat("[VivoxVoice] Error in admin call : {0}", e.Message); | 1142 | m_log.ErrorFormat("[VivoxVoice] Error in admin call : {0}", e.Message); |
1143 | } | ||
1133 | } | 1144 | } |
1134 | 1145 | ||
1135 | // If we're debugging server responses, dump the whole | 1146 | // If we're debugging server responses, dump the whole |