summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2016-04-22 12:07:27 -0700
committerRider Linden <rider@lindenlab.com>2016-04-22 12:07:27 -0700
commit899489ae0a4bc4eb187e7813e338b937384a1866 (patch)
treee83b388e1f35d1fe53701203131cd94ac5216ec2 /indra/newview
parent8f4be8bb869e3cde034607cbe0cb8272005f08b8 (diff)
MAINT-6336: Centralize waiting on event pump with a timeout. Shorten the lifespan of a timeout event pump lifespan to be no longer than necessary. Change all references to the LLEventTimer to instead uses the centralized version.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llvoicevivox.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index ca0509c524..043ddc904b 100755
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -903,8 +903,6 @@ bool LLVivoxVoiceClient::loginToVivox()
LLSD timeoutResult;
timeoutResult["login"] = LLSD::String("timeout");
- LLEventTimeout voicePumpTimeout(voicePump);
-
int loginRetryCount(0);
bool response_ok(false);
@@ -920,8 +918,7 @@ bool LLVivoxVoiceClient::loginToVivox()
send_login = false;
- voicePumpTimeout.eventAfter(LOGIN_ATTEMPT_TIMEOUT, timeoutResult);
- LLSD result = llcoro::suspendUntilEventOn(voicePump);
+ LLSD result = llcoro::suspendUntilEventOnWithTimeout(voicePump, LOGIN_ATTEMPT_TIMEOUT, timeoutResult);
LL_DEBUGS("Voice") << "event=" << ll_pretty_print_sd(result) << LL_ENDL;
if (result.has("login"))
@@ -1018,10 +1015,7 @@ void LLVivoxVoiceClient::logoutOfVivox(bool wait)
LLSD timeoutResult;
timeoutResult["logout"] = LLSD::String("timeout");
- LLEventTimeout voicePumpTimeout(voicePump);
-
- voicePumpTimeout.eventAfter(LOGIN_ATTEMPT_TIMEOUT, timeoutResult);
- LLSD result = llcoro::suspendUntilEventOn(voicePumpTimeout);
+ LLSD result = llcoro::suspendUntilEventOnWithTimeout(voicePump, LOGIN_ATTEMPT_TIMEOUT, timeoutResult);
LL_DEBUGS("Voice") << "event=" << ll_pretty_print_sd(result) << LL_ENDL;
@@ -1231,12 +1225,9 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
// This is a cheap way to make sure both have happened before proceeding.
do
{
- LLEventTimeout voicePumpTimeout(voicePump);
-
- voicePumpTimeout.eventAfter(SESSION_JOIN_TIMEOUT, timeoutResult);
- result = llcoro::suspendUntilEventOn(voicePumpTimeout);
+ result = llcoro::suspendUntilEventOnWithTimeout(voicePump, SESSION_JOIN_TIMEOUT, timeoutResult);
- LL_DEBUGS("Voice") << "event=" << ll_pretty_print_sd(result) << LL_ENDL;
+ LL_INFOS("Voice") << "event=" << ll_pretty_print_sd(result) << LL_ENDL;
if (result.has("session"))
{
if (result.has("handle"))
@@ -1249,6 +1240,9 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
}
std::string message = result["session"].asString();
+// if (message == "joined")
+// message = "removed";
+
if ((message == "added") || (message == "created"))
added = true;
else if (message == "joined")
@@ -1510,7 +1504,6 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
timeoutEvent["timeout"] = LLSD::Boolean(true);
LLEventPump &voicePump = LLEventPumps::instance().obtain("vivoxClientPump");
- LLEventTimeout timeout(voicePump);
mIsInChannel = true;
mMuteMicDirty = true;
@@ -1562,8 +1555,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)
sendLocalAudioUpdates();
mIsInitialized = true;
- timeout.eventAfter(UPDATE_THROTTLE_SECONDS, timeoutEvent);
- LLSD result = llcoro::suspendUntilEventOn(timeout);
+ LLSD result = llcoro::suspendUntilEventOnWithTimeout(voicePump, UPDATE_THROTTLE_SECONDS, timeoutEvent);
if (!result.has("timeout")) // logging the timeout event spams the log
LL_DEBUGS("Voice") << "event=" << ll_pretty_print_sd(result) << LL_ENDL;
if (result.has("session"))
@@ -1667,8 +1659,6 @@ int LLVivoxVoiceClient::voiceRecordBuffer()
LL_INFOS("Voice") << "Recording voice buffer" << LL_ENDL;
LLEventPump &voicePump = LLEventPumps::instance().obtain("vivoxClientPump");
- LLEventTimeout timeout(voicePump);
- timeout.eventAfter(CAPTURE_BUFFER_MAX_TIME, timeoutResult);
LLSD result;
captureBufferRecordStartSendMessage();
@@ -1676,7 +1666,7 @@ int LLVivoxVoiceClient::voiceRecordBuffer()
do
{
- result = llcoro::suspendUntilEventOn(voicePump);
+ result = llcoro::suspendUntilEventOnWithTimeout(voicePump, CAPTURE_BUFFER_MAX_TIME, timeoutResult);
LL_DEBUGS("Voice") << "event=" << ll_pretty_print_sd(result) << LL_ENDL;
} while (!result.has("recplay"));
@@ -1700,12 +1690,10 @@ int LLVivoxVoiceClient::voicePlaybackBuffer()
LL_INFOS("Voice") << "Playing voice buffer" << LL_ENDL;
LLEventPump &voicePump = LLEventPumps::instance().obtain("vivoxClientPump");
- LLEventTimeout timeout(voicePump);
LLSD result;
do
{
- timeout.eventAfter(CAPTURE_BUFFER_MAX_TIME, timeoutResult);
captureBufferPlayStartSendMessage(mPreviewVoiceFont);
// Store the voice font being previewed, so that we know to restart if it changes.
@@ -1716,7 +1704,7 @@ int LLVivoxVoiceClient::voicePlaybackBuffer()
// Update UI, should really use a separate callback.
notifyVoiceFontObservers();
- result = llcoro::suspendUntilEventOn(timeout);
+ result = llcoro::suspendUntilEventOnWithTimeout(voicePump, CAPTURE_BUFFER_MAX_TIME, timeoutResult);
LL_DEBUGS("Voice") << "event=" << ll_pretty_print_sd(result) << LL_ENDL;
} while (!result.has("recplay"));