diff options
-rwxr-xr-x | indra/llcommon/lleventcoro.cpp | 9 | ||||
-rwxr-xr-x | indra/llcommon/lleventcoro.h | 2 | ||||
-rwxr-xr-x | indra/llcommon/lleventfilter.cpp | 4 | ||||
-rwxr-xr-x | indra/llcommon/lleventfilter.h | 3 | ||||
-rwxr-xr-x | indra/newview/llvoicevivox.cpp | 32 |
5 files changed, 26 insertions, 24 deletions
diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp index 578a2b62c8..44291eb711 100755 --- a/indra/llcommon/lleventcoro.cpp +++ b/indra/llcommon/lleventcoro.cpp @@ -229,6 +229,15 @@ LLSD llcoro::postAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requ return value; } +LLSD llcoro::suspendUntilEventOnWithTimeout(const LLEventPumpOrPumpName& pump, F32 timeoutin, const LLSD &timeoutResult) +{ + LLEventTimeout timeoutPump(pump); + + timeoutPump.eventAfter(timeoutin, timeoutResult); + return llcoro::suspendUntilEventOn(timeoutPump); + +} + namespace { diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index 2105faf861..19c68e1f35 100755 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -147,6 +147,8 @@ LLSD suspendUntilEventOn(const LLEventPumpOrPumpName& pump) return postAndSuspend(LLSD(), LLEventPumpOrPumpName(), pump); } +LLSD suspendUntilEventOnWithTimeout(const LLEventPumpOrPumpName& pump, F32 timeoutin, const LLSD &timeoutResult); + } // namespace llcoro /// return type for two-pump variant of suspendUntilEventOn() diff --git a/indra/llcommon/lleventfilter.cpp b/indra/llcommon/lleventfilter.cpp index d36a107254..64ab58adcd 100755 --- a/indra/llcommon/lleventfilter.cpp +++ b/indra/llcommon/lleventfilter.cpp @@ -39,9 +39,9 @@ #include "llsdutil.h" // llsd_matches() LLEventFilter::LLEventFilter(LLEventPump& source, const std::string& name, bool tweak): - LLEventStream(name, tweak) + LLEventStream(name, tweak), + mSource(source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1))) { - source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1)); } LLEventMatching::LLEventMatching(const LLSD& pattern): diff --git a/indra/llcommon/lleventfilter.h b/indra/llcommon/lleventfilter.h index 8e01326823..15bac5fd73 100755 --- a/indra/llcommon/lleventfilter.h +++ b/indra/llcommon/lleventfilter.h @@ -49,6 +49,9 @@ public: /// Post an event to all listeners virtual bool post(const LLSD& event) = 0; + +private: + LLTempBoundListener mSource; }; /** 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")); |