本文整理汇总了C++中LL_INFOS函数的典型用法代码示例。如果您正苦于以下问题:C++ LL_INFOS函数的具体用法?C++ LL_INFOS怎么用?C++ LL_INFOS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LL_INFOS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendPacketImpl
BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host)
{
//<edit>
LLMessageLog::log(LLHost(16777343, gMessageSystem->getListenPort()), host, (U8*)send_buffer, buf_size);
//</edit>
BOOL status = TRUE;
if (!mUseOutThrottle)
{
return sendPacketImpl(h_socket, send_buffer, buf_size, host );
}
else
{
mActualBitsOut += buf_size * 8;
LLPacketBuffer *packetp = NULL;
// See if we've got enough throttle to send a packet.
while (!mOutThrottle.checkOverflow(0.f))
{
// While we have enough bandwidth, send a packet from the queue or the current packet
S32 packet_size = 0;
if (!mSendQueue.empty())
{
// Send a packet off of the queue
LLPacketBuffer *packetp = mSendQueue.front();
mSendQueue.pop();
mOutBufferLength -= packetp->getSize();
packet_size = packetp->getSize();
status = sendPacketImpl(h_socket, packetp->getData(), packet_size, packetp->getHost());
delete packetp;
// Update the throttle
mOutThrottle.throttleOverflow(packet_size * 8.f);
}
else
{
// If the queue's empty, we can just send this packet right away.
status = sendPacketImpl(h_socket, send_buffer, buf_size, host );
packet_size = buf_size;
// Update the throttle
mOutThrottle.throttleOverflow(packet_size * 8.f);
// This was the packet we're sending now, there are no other packets
// that we need to send
return status;
}
}
// We haven't sent the incoming packet, add it to the queue
if (mOutBufferLength + buf_size > mMaxBufferLength)
{
// Nuke this packet, we overflowed the buffer.
// Toss it.
LL_WARNS() << "Throwing away outbound packet, overflowing buffer" << LL_ENDL;
}
else
{
static LLTimer queue_timer;
if ((mOutBufferLength > 4192) && queue_timer.getElapsedTimeF32() > 1.f)
{
// Add it to the queue
LL_INFOS() << "Outbound packet queue " << mOutBufferLength << " bytes" << LL_ENDL;
queue_timer.reset();
}
packetp = new LLPacketBuffer(host, send_buffer, buf_size);
mOutBufferLength += packetp->getSize();
mSendQueue.push(packetp);
}
}
return status;
}
示例2: LL_INFOS
void LLQueryResponder::querySuccess()
{
LL_INFOS() << "LLQueryResponder::queryResult not implemented" << LL_ENDL;
}
示例3: LL_INFOS
/*virtual*/ void LLEnvironmentRequestResponder::error(U32 status, const std::string& reason)
{
LL_INFOS("WindlightCaps") << "Got an error, not using region windlight..." << LL_ENDL;
LLEnvManagerNew::getInstance()->onRegionSettingsResponse(LLSD());
}
示例4: DNS_RR_TYPE
int LLQueryResponder::parseRR(const char *buf, size_t len, const char *&pos,
LLPointer<LLDnsRecord> &r)
{
std::string rrname;
size_t enclen;
int ret;
// RR name.
ret = LLAres::expandName(pos, buf, len, rrname, enclen);
if (ret != ARES_SUCCESS)
{
return ret;
}
pos += enclen;
if (pos + NS_RRFIXEDSZ > buf + len)
{
return ARES_EBADRESP;
}
int rrtype = DNS_RR_TYPE(pos);
int rrclass = DNS_RR_CLASS(pos);
int rrttl = DNS_RR_TTL(pos);
int rrlen = DNS_RR_LEN(pos);
if (rrclass != ns_c_in)
{
return ARES_EBADRESP;
}
pos += NS_RRFIXEDSZ;
if (pos + rrlen > buf + len)
{
return ARES_EBADRESP;
}
switch (rrtype)
{
case RES_A:
r = new LLARecord(rrname, rrttl);
break;
case RES_NS:
r = new LLNsRecord(rrname, rrttl);
break;
case RES_CNAME:
r = new LLCnameRecord(rrname, rrttl);
break;
case RES_PTR:
r = new LLPtrRecord(rrname, rrttl);
break;
case RES_AAAA:
r = new LLAaaaRecord(rrname, rrttl);
break;
case RES_SRV:
r = new LLSrvRecord(rrname, rrttl);
break;
default:
LL_INFOS() << "LLQueryResponder::parseRR got unknown RR type " << rrtype
<< LL_ENDL;
return ARES_EBADRESP;
}
ret = r->parse(buf, len, pos, rrlen);
if (ret == ARES_SUCCESS)
{
pos += rrlen;
} else {
r = NULL;
}
return ret;
}
示例5: setState
void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
{
std::string message_class = message.getClass();
if(message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
{
// internal messages should be handled here
std::string message_name = message.getName();
if(message_name == "hello")
{
if(mState == STATE_CONNECTED)
{
// Plugin host has launched. Tell it which plugin to load.
setState(STATE_HELLO);
}
else
{
LL_WARNS("Plugin") << "received hello message in wrong state -- bailing out" << LL_ENDL;
errorState();
}
}
else if(message_name == "load_plugin_response")
{
if(mState == STATE_LOADING)
{
// Plugin has been loaded.
mPluginVersionString = message.getValue("plugin_version");
LL_INFOS("Plugin") << "plugin version string: " << mPluginVersionString << LL_ENDL;
// Check which message classes/versions the plugin supports.
// TODO: check against current versions
// TODO: kill plugin on major mismatches?
mMessageClassVersions = message.getValueLLSD("versions");
LLSD::map_iterator iter;
for(iter = mMessageClassVersions.beginMap(); iter != mMessageClassVersions.endMap(); iter++)
{
LL_INFOS("Plugin") << "message class: " << iter->first << " -> version: " << iter->second.asString() << LL_ENDL;
}
// Send initial sleep time
setSleepTime(mSleepTime, true);
setState(STATE_RUNNING);
}
else
{
LL_WARNS("Plugin") << "received load_plugin_response message in wrong state -- bailing out" << LL_ENDL;
errorState();
}
}
else if(message_name == "heartbeat")
{
// this resets our timer.
mHeartbeat.setTimerExpirySec(mPluginLockupTimeout);
mCPUUsage = message.getValueReal("cpu_usage");
LL_DEBUGS("Plugin") << "cpu usage reported as " << mCPUUsage << LL_ENDL;
}
else if(message_name == "shm_add_response")
{
// Nothing to do here.
}
else if(message_name == "shm_remove_response")
{
std::string name = message.getValue("name");
sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);
if(iter != mSharedMemoryRegions.end())
{
// destroy the shared memory region
iter->second->destroy();
// and remove it from our map
mSharedMemoryRegions.erase(iter);
}
}
else
{
LL_WARNS("Plugin") << "Unknown internal message from child: " << message_name << LL_ENDL;
}
}
else
{
if(mOwner != NULL)
{
mOwner->receivePluginMessage(message);
}
}
}
示例6: blacklist_data_stream
void FSWSAssetBlacklist::loadBlacklist()
{
if (gDirUtilp->fileExists(mBlacklistFileName))
{
llifstream blacklist_data_stream(mBlacklistFileName.c_str());
if (blacklist_data_stream.is_open())
{
LLSD data;
if (LLSDSerialize::fromXML(data, blacklist_data_stream) >= 1)
{
for (LLSD::map_const_iterator itr = data.beginMap(); itr != data.endMap(); ++itr)
{
LLUUID uid = LLUUID(itr->first);
LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
cipher.decrypt(uid.mData, UUID_BYTES);
LLSD entry_data = itr->second;
if (uid.isNull())
{
continue;
}
LLAssetType::EType type = S32toAssetType(entry_data["asset_type"].asInteger());
if (type == LLAssetType::AT_NONE)
{
continue;
}
addNewItemToBlacklistData(uid, entry_data, false);
}
}
}
blacklist_data_stream.close();
}
else
{
// Try to import old blacklist data from Phoenix
std::string old_file = gDirUtilp->getOSUserDir() + gDirUtilp->getDirDelimiter() + "SecondLife" + gDirUtilp->getDirDelimiter() + "user_settings" + gDirUtilp->getDirDelimiter() + "floater_blist_settings.xml";
if (gDirUtilp->fileExists(old_file))
{
LLSD datallsd;
llifstream oldfile;
oldfile.open(old_file.c_str());
if (oldfile.is_open())
{
LLSDSerialize::fromXMLDocument(datallsd, oldfile);
for (LLSD::map_const_iterator itr = datallsd.beginMap(); itr != datallsd.endMap(); ++itr)
{
LLUUID uid = LLUUID(itr->first);
LLSD data = itr->second;
if (uid.isNull() || !data.has("entry_name") || !data.has("entry_type") || !data.has("entry_date"))
{
continue;
}
LLAssetType::EType type = S32toAssetType(data["entry_type"].asInteger());
LLSD newdata;
newdata["asset_name"] = "[PHOENIX] " + data["entry_name"].asString();
newdata["asset_type"] = type;
newdata["asset_date"] = data["entry_date"].asString();
//if (!data["ID_hashed"].asBoolean())
//{
// uid = LLUUID::generateNewID(uid.asString() + "hash");
//}
addNewItemToBlacklistData(uid, newdata, false);
}
}
oldfile.close();
saveBlacklist();
LL_INFOS("AssetBlacklist") << "Using old Phoenix file: " << old_file << LL_ENDL;
}
else
{
LL_INFOS("AssetBlacklist") << "No Settings file found." << old_file << LL_ENDL;
}
}
}
示例7: LL_DEBUGS
//static
gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gpointer data)
{
#ifdef LL_GST_REPORT_STATE_CHANGES
LL_DEBUGS("MediaCallback") << "Got GST message type: " << GST_MESSAGE_TYPE_NAME (message) << LL_ENDL;
#endif
LLMediaImplGStreamer *impl = (LLMediaImplGStreamer*)data;
switch (GST_MESSAGE_TYPE (message))
{
case GST_MESSAGE_BUFFERING:
{
gint percent = 0;
gst_message_parse_buffering(message, &percent);
#ifdef LL_GST_REPORT_STATE_CHANGES
LL_DEBUGS("MediaBuffering") << "GST buffering: " << percent << "%%" << LL_ENDL;
#endif
LLMediaEvent event( impl, percent );
impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event );
}
break;
case GST_MESSAGE_STATE_CHANGED:
{
GstState old_state;
GstState new_state;
GstState pending_state;
gst_message_parse_state_changed(message,
&old_state,
&new_state,
&pending_state);
#ifdef LL_GST_REPORT_STATE_CHANGES
// not generally very useful, and rather spammy.
LL_DEBUGS("MediaState") << "GST state change (old,<new>,pending): "<< get_gst_state_name(old_state) << ",<" << get_gst_state_name(new_state) << ">," << get_gst_state_name(pending_state) << LL_ENDL;
#endif // LL_GST_REPORT_STATE_CHANGES
switch (new_state)
{
case GST_STATE_VOID_PENDING:
break;
case GST_STATE_NULL:
#ifdef LL_GST_REPORT_STATE_CHANGES
LL_DEBUGS("MediaImpl") << "State changed to NULL" << LL_ENDL;
#endif
if (impl->getState() == GST_STATE_PLAYING)
{
// Stream was probably dropped, trying to restart
impl->play();
#ifdef LL_GST_REPORT_STATE_CHANGES
LL_DEBUGS("MediaImpl") << "Trying to restart." << LL_ENDL;
#endif
}
break;
case GST_STATE_READY:
break;
case GST_STATE_PAUSED:
break;
case GST_STATE_PLAYING:
//impl->mLastTitle = "";
LLMediaEvent event( impl, 100 );
impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event );
// emit an event to say that a media source was loaded
LLMediaEvent event2( impl );
impl->getEventEmitter().update( &LLMediaObserver::onMediaLoaded, event2 );
break;
}
break;
}
case GST_MESSAGE_ERROR:
{
GError *err = NULL;
gchar *debug = NULL;
gst_message_parse_error (message, &err, &debug);
LL_WARNS("MediaImpl") << "GST Error: " << err->message << LL_ENDL;
g_error_free (err);
g_free (debug);
impl->addCommand(LLMediaBase::COMMAND_STOP);
//impl->addCommand(LLMediaBase::COMMAND_START);
break;
}
case GST_MESSAGE_INFO:
{
GError *err = NULL;
gchar *debug = NULL;
gst_message_parse_info (message, &err, &debug);
LL_INFOS("MediaImpl") << "GST info: " << err->message
<< LL_ENDL;
g_error_free (err);
g_free (debug);
break;
}
case GST_MESSAGE_WARNING:
{
GError *err = NULL;
gchar *debug = NULL;
//.........这里部分代码省略.........
示例8: LL_WARNS
void GrowlManager::loadConfig()
{
std::string config_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "growl_notifications.xml");
if (config_file.empty())
{
LL_WARNS("GrowlConfig") << "Couldn't find growl_notifications.xml" << LL_ENDL;
return;
}
LL_INFOS("GrowlConfig") << "Loading growl notification config from " << config_file << LL_ENDL;
llifstream configs(config_file);
LLSD notificationLLSD;
std::set<std::string> notificationTypes;
notificationTypes.insert("Keyword Alert");
notificationTypes.insert(GROWL_IM_MESSAGE_TYPE);
if (configs.is_open())
{
LLSDSerialize::fromXML(notificationLLSD, configs);
for (LLSD::map_iterator itr = notificationLLSD.beginMap(); itr != notificationLLSD.endMap(); ++itr)
{
GrowlNotification ntype;
ntype.growlName = itr->second.get("GrowlName").asString();
notificationTypes.insert(ntype.growlName);
if (itr->second.has("GrowlTitle"))
{
ntype.growlTitle = itr->second.get("GrowlTitle").asString();
}
if (itr->second.has("GrowlBody"))
{
ntype.growlBody = itr->second.get("GrowlBody").asString();
}
if (itr->second.has("UseDefaultTextForTitle"))
{
ntype.useDefaultTextForTitle = itr->second.get("UseDefaultTextForTitle").asBoolean();
}
else
{
ntype.useDefaultTextForTitle = false;
}
if (itr->second.has("UseDefaultTextForBody"))
{
ntype.useDefaultTextForBody = itr->second.get("UseDefaultTextForBody").asBoolean();
}
else
{
ntype.useDefaultTextForBody = false;
}
if (!ntype.useDefaultTextForBody && !ntype.useDefaultTextForTitle && ntype.growlBody.empty() && ntype.growlTitle.empty())
{
ntype.useDefaultTextForBody = true;
}
this->mNotifications[itr->first] = ntype;
}
configs.close();
this->mNotifier->registerApplication("Firestorm Viewer", notificationTypes);
}
else
{
LL_WARNS("GrowlConfig") << "Couldn't open growl config file." << LL_ENDL;
}
}
示例9: switch
//.........这里部分代码省略.........
std::string url = self->getClickURL();
std::string target = self->getClickTarget();
std::string uuid = self->getClickUUID();
LLNotification::Params notify_params("PopupAttempt");
notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", mMediaTextureID);
notify_params.functor(boost::bind(&LLMediaCtrl::onPopup, this, _1, _2));
if (mTrusted)
{
LLNotifications::instance().forceResponse(notify_params, 0);
}
else
{
LLNotifications::instance().add(notify_params);
}
break;
};
case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is " << self->getClickURL() << LL_ENDL;
};
break;
case MEDIA_EVENT_PLUGIN_FAILED:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED" << LL_ENDL;
};
break;
case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PLUGIN_FAILED_LAUNCH" << LL_ENDL;
};
break;
case MEDIA_EVENT_NAME_CHANGED:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAME_CHANGED" << LL_ENDL;
};
break;
case MEDIA_EVENT_CLOSE_REQUEST:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << LL_ENDL;
}
break;
case MEDIA_EVENT_PICK_FILE_REQUEST:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << LL_ENDL;
}
break;
case MEDIA_EVENT_GEOMETRY_CHANGE:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;
}
break;
case MEDIA_EVENT_AUTH_REQUEST:
{
LLNotification::Params auth_request_params("AuthRequest");
// pass in host name and realm for site (may be zero length but will always exist)
LLSD args;
LLURL raw_url( self->getAuthURL().c_str() );
args["HOST_NAME"] = raw_url.getAuthority();
args["REALM"] = self->getAuthRealm();
auth_request_params.substitutions = args;
auth_request_params.payload = LLSD().with("media_id", mMediaTextureID);
auth_request_params.functor(boost::bind(&LLViewerMedia::onAuthSubmit, _1, _2));
LLNotifications::instance().add(auth_request_params);
};
break;
case MEDIA_EVENT_LINK_HOVERED:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LINK_HOVERED, hover text is: " << self->getHoverText() << LL_ENDL;
mHoverTextChanged = true;
};
break;
case MEDIA_EVENT_DEBUG_MESSAGE:
{
LL_INFOS("media") << self->getDebugMessageText() << LL_ENDL;
};
break;
default:
{
LL_WARNS("Media") << "Media event: unknown event type" << LL_ENDL;
};
};
// chain all events to any potential observers of this object.
emitEvent(self, event);
}
示例10: stripChannelNumber
void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate)
{
// Look for "/20 foo" channel chats.
S32 channel = 0;
LLWString out_text = stripChannelNumber(wtext, &channel);
std::string utf8_out_text = wstring_to_utf8str(out_text);
std::string utf8_text = wstring_to_utf8str(wtext);
utf8_text = utf8str_trim(utf8_text);
if (!utf8_text.empty())
{
utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
}
// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0b
if ( (0 == channel) && (rlv_handler_t::isEnabled()) )
{
// Adjust the (public) chat "volume" on chat and gestures (also takes care of playing the proper animation)
if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATNORMAL)) )
type = CHAT_TYPE_WHISPER;
else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATSHOUT)) )
type = CHAT_TYPE_NORMAL;
else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) )
type = CHAT_TYPE_NORMAL;
animate &= !gRlvHandler.hasBehaviour( (!RlvUtil::isEmote(utf8_text)) ? RLV_BHVR_REDIRCHAT : RLV_BHVR_REDIREMOTE );
}
// [/RLVa:KB]
LLCachedControl<bool> disable_chat_animation("SGDisableChatAnimation");
// Don't animate for chats people can't hear (chat to scripts)
if (animate && (channel == 0) && !disable_chat_animation)
{
if (type == CHAT_TYPE_WHISPER)
{
LL_DEBUGS() << "You whisper " << utf8_text << LL_ENDL;
gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START);
}
else if (type == CHAT_TYPE_NORMAL)
{
LL_DEBUGS() << "You say " << utf8_text << LL_ENDL;
gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START);
}
else if (type == CHAT_TYPE_SHOUT)
{
LL_DEBUGS() << "You shout " << utf8_text << LL_ENDL;
gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START);
}
else
{
LL_INFOS() << "send_chat_from_viewer() - invalid volume" << LL_ENDL;
return;
}
}
else
{
if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP)
{
LL_DEBUGS() << "Channel chat: " << utf8_text << LL_ENDL;
}
}
send_chat_from_viewer(utf8_out_text, type, channel);
}
示例11: LLPanel
//---------------------------------------------------------------------------
// Public methods
//---------------------------------------------------------------------------
LLPanelLogin::LLPanelLogin(const LLRect& rect)
: LLPanel(std::string("panel_login"), rect, FALSE), // not bordered
mLogoImage(LLUI::getUIImage("startup_logo.j2c"))
{
setFocusRoot(TRUE);
setBackgroundVisible(FALSE);
setBackgroundOpaque(TRUE);
LLPanelLogin::sInstance = this;
// add to front so we are the bottom-most child
gViewerWindow->getRootView()->addChildInBack(this);
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml");
reshape(rect.getWidth(), rect.getHeight());
LLComboBox* username_combo(getChild<LLComboBox>("username_combo"));
username_combo->setCommitCallback(boost::bind(LLPanelLogin::onSelectLoginEntry, _1, this));
username_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLoginComboLostFocus, this, username_combo));
username_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe);
username_combo->setSuppressTentative(true);
username_combo->setSuppressAutoComplete(true);
childSetCommitCallback("remember_name_check", onNameCheckChanged);
LLLineEditor* password_edit(getChild<LLLineEditor>("password_edit"));
password_edit->setKeystrokeCallback(onPassKey);
// STEAM-14: When user presses Enter with this field in focus, initiate login
password_edit->setCommitCallback(mungePassword, this);
password_edit->setDrawAsterixes(TRUE);
getChild<LLUICtrl>("remove_login")->setCommitCallback(boost::bind(&LLPanelLogin::confirmDelete, this));
// change z sort of clickable text to be behind buttons
sendChildToBack(getChildView("channel_text"));
sendChildToBack(getChildView("forgot_password_text"));
//llinfos << " url history: " << LLSDOStreamer<LLSDXMLFormatter>(LLURLHistory::getURLHistory("regionuri")) << llendl;
LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo");
updateLocationSelectorsVisibility(); // separate so that it can be called from preferences
location_combo->setAllowTextEntry(TRUE, 128, FALSE);
location_combo->setFocusLostCallback( boost::bind(&LLPanelLogin::onLocationSLURL, this) );
LLComboBox *server_choice_combo = getChild<LLComboBox>("grids_combo");
server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1));
server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, server_choice_combo));
// Load all of the grids, sorted, and then add a bar and the current grid at the top
updateGridCombo();
LLSLURL start_slurl(LLStartUp::getStartSLURL());
if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ?
{
// no, so get the preference setting
std::string defaultStartLocation = gSavedSettings.getString("LoginLocation");
LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL;
LLSLURL defaultStart(defaultStartLocation);
if ( defaultStart.isSpatial() )
{
LLStartUp::setStartSLURL(defaultStart); // calls onUpdateStartSLURL
}
else
{
LL_INFOS("AppInit")<<"no valid LoginLocation, using home"<<LL_ENDL;
LLSLURL homeStart(LLSLURL::SIM_LOCATION_HOME);
LLStartUp::setStartSLURL(homeStart); // calls onUpdateStartSLURL
}
}
else
{
LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed
}
// Also set default button for subpanels, otherwise hitting enter in text entry fields won't login
{
LLButton* connect_btn(findChild<LLButton>("connect_btn"));
connect_btn->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this));
setDefaultBtn(connect_btn);
findChild<LLPanel>("name_panel")->setDefaultBtn(connect_btn);
findChild<LLPanel>("password_panel")->setDefaultBtn(connect_btn);
findChild<LLPanel>("grids_panel")->setDefaultBtn(connect_btn);
findChild<LLPanel>("location_panel")->setDefaultBtn(connect_btn);
findChild<LLPanel>("login_html")->setDefaultBtn(connect_btn);
}
childSetAction("grids_btn", onClickGrids, this);
std::string channel = gVersionChannel;
std::string version = llformat("%d.%d.%d (%d)",
gVersionMajor,
gVersionMinor,
gVersionPatch,
//.........这里部分代码省略.........
示例12: start_net
S32 start_net(S32& socket_out, int& nPort)
{
// Create socket, make non-blocking
// Init WinSock
int nRet;
int hSocket;
int snd_size = SEND_BUFFER_SIZE;
int rec_size = RECEIVE_BUFFER_SIZE;
int buff_size = 4;
// Initialize windows specific stuff
if(WSAStartup(0x0202, &stWSAData))
{
S32 err = WSAGetLastError();
WSACleanup();
LL_WARNS("AppInit") << "Windows Sockets initialization failed, err " << err << LL_ENDL;
return 1;
}
// Get a datagram socket
hSocket = (int)socket(AF_INET, SOCK_DGRAM, 0);
if (hSocket == INVALID_SOCKET)
{
S32 err = WSAGetLastError();
WSACleanup();
LL_WARNS("AppInit") << "socket() failed, err " << err << LL_ENDL;
return 2;
}
// Name the socket (assign the local port number to receive on)
stLclAddr.sin_family = AF_INET;
stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY);
stLclAddr.sin_port = htons(nPort);
S32 attempt_port = nPort;
LL_DEBUGS("AppInit") << "attempting to connect on port " << attempt_port << LL_ENDL;
nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr));
if (nRet == SOCKET_ERROR)
{
// If we got an address in use error...
if (WSAGetLastError() == WSAEADDRINUSE)
{
// Try all ports from PORT_DISCOVERY_RANGE_MIN to PORT_DISCOVERY_RANGE_MAX
for(attempt_port = PORT_DISCOVERY_RANGE_MIN;
attempt_port <= PORT_DISCOVERY_RANGE_MAX;
attempt_port++)
{
stLclAddr.sin_port = htons(attempt_port);
LL_DEBUGS("AppInit") << "trying port " << attempt_port << LL_ENDL;
nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr));
if (!(nRet == SOCKET_ERROR &&
WSAGetLastError() == WSAEADDRINUSE))
{
break;
}
}
if (nRet == SOCKET_ERROR)
{
LL_WARNS("AppInit") << "startNet() : Couldn't find available network port." << LL_ENDL;
// Fail gracefully here in release
return 3;
}
}
else
// Some other socket error
{
LL_WARNS("AppInit") << llformat("bind() port: %d failed, Err: %d\n", nPort, WSAGetLastError()) << LL_ENDL;
// Fail gracefully in release.
return 4;
}
}
sockaddr_in socket_address;
S32 socket_address_size = sizeof(socket_address);
getsockname(hSocket, (SOCKADDR*) &socket_address, &socket_address_size);
attempt_port = ntohs(socket_address.sin_port);
LL_INFOS("AppInit") << "connected on port " << attempt_port << LL_ENDL;
nPort = attempt_port;
// Set socket to be non-blocking
unsigned long argp = 1;
nRet = ioctlsocket (hSocket, FIONBIO, &argp);
if (nRet == SOCKET_ERROR)
{
printf("Failed to set socket non-blocking, Err: %d\n",
WSAGetLastError());
}
// set a large receive buffer
nRet = setsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, buff_size);
if (nRet)
{
LL_INFOS("AppInit") << "Can't set receive buffer size!" << LL_ENDL;
}
//.........这里部分代码省略.........
示例13: LL_INFOS
//.........这里部分代码省略.........
if (!mChannels[i])
{
continue;
}
LLAudioSource *asp;
asp = mChannels[i]->getSource();
if (!asp)
{
continue;
}
if (asp->getPriority() <= max_pri)
{
continue;
}
for (data_iter = asp->mPreloadMap.begin(); data_iter != asp->mPreloadMap.end(); data_iter++)
{
LLAudioData *adp = data_iter->second;
if (!adp)
{
continue;
}
if (!adp->hasLocalData() && adp->hasValidData())
{
asset_id = adp->getID();
max_pri = asp->getPriority();
}
}
}
}
// Check all sources
if (asset_id.isNull())
{
max_pri = -1.f;
source_map::iterator source_iter;
for (source_iter = mAllSources.begin(); source_iter != mAllSources.end(); source_iter++)
{
asp = source_iter->second;
if (!asp)
{
continue;
}
if (asp->getPriority() <= max_pri)
{
continue;
}
adp = asp->getCurrentData();
if (adp && !adp->hasLocalData() && adp->hasValidData())
{
asset_id = adp->getID();
max_pri = asp->getPriority();
continue;
}
adp = asp->getQueuedData();
if (adp && !adp->hasLocalData() && adp->hasValidData())
{
asset_id = adp->getID();
max_pri = asp->getPriority();
continue;
}
for (data_iter = asp->mPreloadMap.begin(); data_iter != asp->mPreloadMap.end(); data_iter++)
{
LLAudioData *adp = data_iter->second;
if (!adp)
{
continue;
}
if (!adp->hasLocalData() && adp->hasValidData())
{
asset_id = adp->getID();
max_pri = asp->getPriority();
break;
}
}
}
}
if (asset_id.notNull())
{
LL_INFOS() << "Getting asset data for: " << asset_id << LL_ENDL;
mCurrentTransfer = asset_id;
mCurrentTransferTimer.reset();
gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND,
assetCallback, NULL);
}
else
{
//LL_INFOS() << "No pending transfers?" << LL_ENDL;
}
}
示例14: mapWindVecToPitch
//.........这里部分代码省略.........
if (!mEnableWind)
return;
if(!mWindBuf)
return;
if (mWindUpdateTimer.checkExpirationAndReset(LL_WIND_UPDATE_INTERVAL))
{
// wind comes in as Linden coordinate (+X = forward, +Y = left, +Z = up)
// need to convert this to the conventional orientation DS3D and OpenAL use
// where +X = right, +Y = up, +Z = backwards
wind_vec.setVec(-wind_vec.mV[1], wind_vec.mV[2], -wind_vec.mV[0]);
pitch = 1.0 + mapWindVecToPitch(wind_vec);
center_freq = 80.0 * pow(pitch,2.5*(mapWindVecToGain(wind_vec)+1.0));
mWindGen->mTargetFreq = (F32)center_freq;
mWindGen->mTargetGain = (F32)mapWindVecToGain(wind_vec) * mMaxWindGain;
mWindGen->mTargetPanGainR = (F32)mapWindVecToPan(wind_vec);
alSourcei(mWindSource, AL_LOOPING, AL_FALSE);
alSource3f(mWindSource, AL_POSITION, 0.0, 0.0, 0.0);
alSource3f(mWindSource, AL_VELOCITY, 0.0, 0.0, 0.0);
alSourcef(mWindSource, AL_ROLLOFF_FACTOR, 0.0);
alSourcei(mWindSource, AL_SOURCE_RELATIVE, AL_TRUE);
}
// ok lets make a wind buffer now
int processed, queued, unprocessed;
alGetSourcei(mWindSource, AL_BUFFERS_PROCESSED, &processed);
alGetSourcei(mWindSource, AL_BUFFERS_QUEUED, &queued);
unprocessed = queued - processed;
// ensure that there are always at least 3x as many filled buffers
// queued as we managed to empty since last time.
mNumEmptyWindALBuffers = llmin(mNumEmptyWindALBuffers + processed * 3 - unprocessed, MAX_NUM_WIND_BUFFERS-unprocessed);
mNumEmptyWindALBuffers = llmax(mNumEmptyWindALBuffers, 0);
//LL_INFOS("OpenAL") << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << LL_ENDL;
while(processed--) // unqueue old buffers
{
ALuint buffer;
int error;
alGetError(); /* clear error */
alSourceUnqueueBuffers(mWindSource, 1, &buffer);
error = alGetError();
if(error != AL_NO_ERROR)
{
LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers" << LL_ENDL;
}
else
{
alDeleteBuffers(1, &buffer);
}
}
unprocessed += mNumEmptyWindALBuffers;
while (mNumEmptyWindALBuffers > 0) // fill+queue new buffers
{
ALuint buffer;
alGetError(); /* clear error */
alGenBuffers(1,&buffer);
if((error=alGetError()) != AL_NO_ERROR)
{
LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::initWind() Error creating wind buffer: " << error << LL_ENDL;
break;
}
alBufferData(buffer,
AL_FORMAT_STEREO16,
mWindGen->windGenerate(mWindBuf,
mWindBufSamples, 2),
mWindBufBytes,
mWindBufFreq);
error = alGetError();
if(error != AL_NO_ERROR)
LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << LL_ENDL;
alSourceQueueBuffers(mWindSource, 1, &buffer);
error = alGetError();
if(error != AL_NO_ERROR)
LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << LL_ENDL;
--mNumEmptyWindALBuffers;
}
int playing;
alGetSourcei(mWindSource, AL_SOURCE_STATE, &playing);
if(playing != AL_PLAYING)
{
alSourcePlay(mWindSource);
LL_INFOS("OpenAL") << "Wind had stopped - probably ran out of buffers - restarting: " << (unprocessed+mNumEmptyWindALBuffers) << " now queued." << LL_ENDL;
}
}
示例15: setSocketTimeout
//.........这里部分代码省略.........
}
// FIXME: For some reason, the apr timeout stuff isn't working properly on windows.
// Until such time as we figure out why, don't try to use the socket timeout -- just sleep here instead.
#if LL_WINDOWS
if(result)
{
if(timeout != 0.0f)
{
ms_sleep((int)(timeout * 1000.0f));
timeout = 0.0f;
}
}
#endif
// Check for incoming messages
if(result)
{
char input_buf[1024];
apr_size_t request_size;
// Start out by reading one byte, so that any data received will wake us up.
request_size = 1;
// and use the timeout so we'll sleep if no data is available.
setSocketTimeout((apr_interval_time_t)(timeout * 1000000));
while(1)
{
size = request_size;
// LL_INFOS("Plugin") << "before apr_socket_recv, size = " << size << LL_ENDL;
status = apr_socket_recv(
mSocket->getSocket(),
input_buf,
&size);
// LL_INFOS("Plugin") << "after apr_socket_recv, size = " << size << LL_ENDL;
if(size > 0)
mInput.append(input_buf, size);
if(status == APR_SUCCESS)
{
// llinfos << "success, read " << size << llendl;
if(size != request_size)
{
// This was a short read, so we're done.
break;
}
}
else if(APR_STATUS_IS_TIMEUP(status))
{
// llinfos << "TIMEUP, read " << size << llendl;
// Timeout was hit. Since the initial read is 1 byte, this should never be a partial read.
break;
}
else if(APR_STATUS_IS_EAGAIN(status))
{
// llinfos << "EAGAIN, read " << size << llendl;
// We've been doing partial reads, and we're done now.
break;
}
else
{
// some other error
// Treat this as fatal.
ll_apr_warn_status(status);
if(mOwner)
{
mOwner->socketError(status);
}
result = false;
break;
}
// Second and subsequent reads should not use the timeout
setSocketTimeout(0);
// and should try to fill the input buffer
request_size = sizeof(input_buf);
}
processInput();
}
}
if(!result)
{
// If we got an error, we're done.
LL_INFOS("Plugin") << "Error from socket, cleaning up." << LL_ENDL;
delete this;
}
return result;
}