void LLUpdateChecker::Implementation::httpFailure() { const std::string& reason = getReason(); mInProgress = false; LL_WARNS("UpdaterService") << "update check failed; " << reason << LL_ENDL; mClient.error(reason); }
void LLUpdateChecker::Implementation::httpCompleted() { mInProgress = false; S32 status = getStatus(); const LLSD& content = getContent(); const std::string& reason = getReason(); if(status != 200) { std::string server_error; if ( content.has("error_code") ) { server_error += content["error_code"].asString(); } if ( content.has("error_text") ) { server_error += server_error.empty() ? "" : ": "; server_error += content["error_text"].asString(); } LL_WARNS("UpdaterService") << "response error " << status << " " << reason << " (" << server_error << ")" << LL_ENDL; mClient.error(reason); } else { mClient.response(content); } }
/*virtual*/ void httpFailure() { LL_WARNS("ExperienceCache") << "Request failed "<<getStatus()<<" "<<getReason()<< LL_ENDL; // We're going to construct a dummy record and cache it for a while, // either briefly for a 503 Service Unavailable, or longer for other // errors. F64 retry_timestamp = errorRetryTimestamp(getStatus()); // Add dummy records for all agent IDs in this request ask_queue_t::const_iterator it = mKeys.begin(); for ( ; it != mKeys.end(); ++it) { LLSD exp = get(it->first); //leave the properties alone if we already have a cache entry for this xp if(exp.isUndefined()) { exp[PROPERTIES]=PROPERTY_INVALID; } exp[EXPIRES]=retry_timestamp; exp[EXPERIENCE_ID] = it->first; exp["key_type"] = it->second; exp["uuid"] = it->first; exp["error"] = (LLSD::Integer)getStatus(); exp[QUOTA] = DEFAULT_QUOTA; LLExperienceCache::processExperience(it->first, exp); } }
void ExperienceAssociationResponder::httpFailure() { LLSD msg; msg["error"]=(LLSD::Integer)getStatus(); msg["message"]=getReason(); LL_INFOS("ExperienceAssociation") << "Failed to look up associated experience: " << getStatus() << ": " << getReason() << LL_ENDL; sendResult(msg); }
bool GameOver::operator==(const GameOver& other) const { return true && _isReasonSet(mgen::SHALLOW) == other._isReasonSet(mgen::SHALLOW) && _isWinnerSet(mgen::SHALLOW) == other._isWinnerSet(mgen::SHALLOW) && _isLoserSet(mgen::SHALLOW) == other._isLoserSet(mgen::SHALLOW) && _isEndStateSet(mgen::SHALLOW) == other._isEndStateSet(mgen::SHALLOW) && getReason() == other.getReason() && getWinner() == other.getWinner() && getLoser() == other.getLoser() && getEndState() == other.getEndState(); }
void MergedTransactionTest::test_add_obsoleted_installed() { return; /* def test_add_obsoleted_installed(self): """Test add with an obsoleted NEVRA which was installed before.""" ops = dnf.history.NEVRAOperations() ops.add('Install', 'lotus-0:3-16.x86_64') ops.add('Install', 'tour-0:4.6-1.noarch', obsoleted_nevras=('lotus-0:3-16.x86_64',)) self.assertCountEqual( ops, (('Install', 'tour-0:4.6-1.noarch', None, set()),)) */ auto trans1 = std::make_shared< SwdbPrivate::Transaction >(conn); auto trans1_lotus = trans1->addItem( nevraToRPMItem(conn, "lotus-0:3-16.x86_64"), "repo1", TransactionItemAction::INSTALL, TransactionItemReason::DEPENDENCY ); auto trans2 = std::make_shared< SwdbPrivate::Transaction >(conn); auto trans2_tour = trans2->addItem( nevraToRPMItem(conn, "tour-0:4.6-1.noarch"), "repo2", TransactionItemAction::INSTALL, TransactionItemReason::USER ); auto trans2_lotus = trans2->addItem(nevraToRPMItem(conn, "lotus-0:3-16.x86_64"), "repo1", TransactionItemAction::OBSOLETED, TransactionItemReason::DEPENDENCY); trans2_lotus->addReplacedBy(trans2_tour); MergedTransaction merged(trans1); merged.merge(trans2); auto items = merged.getItems(); CPPUNIT_ASSERT_EQUAL(1, (int)items.size()); auto item = items.at(0); CPPUNIT_ASSERT_EQUAL(std::string("repo2"), item->getRepoid()); CPPUNIT_ASSERT_EQUAL(TransactionItemAction::INSTALL, item->getAction()); CPPUNIT_ASSERT_EQUAL(TransactionItemReason::USER, item->getReason()); }
int CardDevice::at_response_cend(char* str, size_t len) { int call_index = 0; int duration = 0; int end_status = 0; int cc_cause = 0; /* * parse CEND info in the following format: * ^CEND:<call_index>,<duration>,<end_status>[,<cc_cause>] */ if (!sscanf (str, "^CEND:%d,%d,%d,%d", &call_index, &duration, &end_status, &cc_cause)) { Debug(DebugAll, "[%s] Could not parse all CEND parameters", c_str()); } Debug(DebugAll, "[%s] CEND: call_index: %d", c_str(), call_index); Debug(DebugAll, "[%s] CEND: duration: %d", c_str(), duration); Debug(DebugAll, "[%s] CEND: end_status: %d", c_str(), end_status); Debug(DebugAll, "[%s] CEND: cc_cause: %d", c_str(), cc_cause); Debug(DebugAll, "[%s] Line disconnected", c_str()); m_needchup = 0; //TODO: if(m_conn) { Debug(DebugAll, "[%s] hanging up owner", c_str()); int reason = getReason(end_status, cc_cause); if(Hangup(reason) == false) { Debug(DebugAll, "[%s] Error on hangup...", c_str()); return -1; } } m_incoming = 0; m_outgoing = 0; m_needring = 0; return 0; }
void MergedTransactionTest::test_add_install_removed() { return; /* def test_add_install_removed(self): """Test add with an install of NEVRA which was removed before.""" ops = dnf.history.NEVRAOperations() ops.add('Erase', 'tour-0:4.6-1.noarch') ops.add('Install', 'tour-0:4.6-1.noarch') self.assertCountEqual( ops, (('Reinstall', 'tour-0:4.6-1.noarch', 'tour-0:4.6-1.noarch', set()),)) */ auto trans1 = std::make_shared< SwdbPrivate::Transaction >(conn); auto trans1_tour = trans1->addItem( nevraToRPMItem(conn, "tour-0:4.6-1.noarch"), "repo1", TransactionItemAction::REMOVE, TransactionItemReason::DEPENDENCY ); auto trans2 = std::make_shared< SwdbPrivate::Transaction >(conn); auto trans2_tour = trans2->addItem( nevraToRPMItem(conn, "tour-0:4.6-1.noarch"), "repo2", TransactionItemAction::INSTALL, TransactionItemReason::USER ); MergedTransaction merged(trans1); merged.merge(trans2); auto items = merged.getItems(); CPPUNIT_ASSERT_EQUAL(1, (int)items.size()); auto item = items.at(0); CPPUNIT_ASSERT_EQUAL(std::string("repo2"), item->getRepoid()); CPPUNIT_ASSERT_EQUAL(TransactionItemAction::REINSTALL, item->getAction()); CPPUNIT_ASSERT_EQUAL(TransactionItemReason::USER, item->getReason()); }
virtual void httpFailure() { const S32 statusNum = getStatus(); const std::string& reason = getReason(); LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { LL_WARNS() << "HTTP error result for avatar weight POST: " << statusNum << ", " << reason << " returned by region " << regionp->getName() << LL_ENDL; } else { LL_WARNS() << "Avatar render weight POST error recieved but region not found for " << mRegionHandle << ", error " << statusNum << ", " << reason << LL_ENDL; } }
void ProtocolLogin::onRecvFirstMessage(NetworkMessage& msg) { if( #if defined(WINDOWS) && !defined(_CONSOLE) !GUI::getInstance()->m_connections || #endif g_game.getGameState() == GAMESTATE_SHUTDOWN) { getConnection()->close(); return; } uint32_t clientIp = getConnection()->getIP(); msg.get<uint16_t>(); uint16_t version = msg.get<uint16_t>(); msg.skip(12); #ifdef _MULTIPLATFORM77 if(!RSA_decrypt(msg)) { getConnection()->close(); return; } uint32_t key[4] = {msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>()}; enableXTEAEncryption(); setXTEAKey(key); #endif uint32_t name = msg.get<uint32_t>(); std::string password = msg.getString(); if(!name) { if(!g_config.getBool(ConfigManager::ACCOUNT_MANAGER)) { disconnectClient(0x0A, "Invalid account name."); return; } name = 1; password = "******"; } if(!g_config.getBool(ConfigManager::MANUAL_ADVANCED_CONFIG)) { if(version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX) { disconnectClient(0x0A, CLIENT_VERSION_STRING); return; } else if(version < g_config.getNumber(ConfigManager::VERSION_MIN) || version > g_config.getNumber(ConfigManager::VERSION_MAX)) { disconnectClient(0x0A, g_config.getString(ConfigManager::VERSION_MSG).c_str()); return; } } #ifdef CLIENT_VERSION_DATA if(sprSignature != CLIENT_VERSION_SPR) { disconnectClient(0x0A, CLIENT_VERSION_DATA); return; } if(datSignature != CLIENT_VERSION_DAT) { disconnectClient(0x0A, CLIENT_VERSION_DATA); return; } if(picSignature != CLIENT_VERSION_PIC) { disconnectClient(0x0A, CLIENT_VERSION_DATA); return; } #endif if(g_game.getGameState() < GAMESTATE_NORMAL) { disconnectClient(0x0A, "Server is just starting up, please wait."); return; } if(g_game.getGameState() == GAMESTATE_MAINTAIN) { disconnectClient(0x0A, "Server is under maintenance, please re-connect in a while."); return; } if(ConnectionManager::getInstance()->isDisabled(clientIp, protocolId)) { disconnectClient(0x0A, "Too many connections attempts from your IP address, please try again later."); return; } if(IOBan::getInstance()->isIpBanished(clientIp)) { disconnectClient(0x0A, "Your IP is banished!"); return; } uint32_t id = 1; if(!IOLoginData::getInstance()->getAccountId(name, id)) { ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, false); disconnectClient(0x0A, "Invalid account id."); return; } Account account = IOLoginData::getInstance()->loadAccount(id); if(!encryptTest(account.salt + password, account.password)) { ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, false); disconnectClient(0x0A, "Invalid password."); return; } Ban ban; ban.value = account.number; ban.type = BAN_ACCOUNT; if(IOBan::getInstance()->getData(ban) && !IOLoginData::getInstance()->hasFlag(account.number, PlayerFlag_CannotBeBanned)) { bool deletion = ban.expires < 0; std::string name_ = "Automatic "; if(!ban.adminId) name_ += (deletion ? "deletion" : "banishment"); else IOLoginData::getInstance()->getNameByGuid(ban.adminId, name_, true); std::stringstream ss; ss << "Your account has been " << (deletion ? "deleted" : "banished") << " at:\n" << formatDateEx(ban.added, "%d %b %Y").c_str() << " by: " << name_.c_str() << "\nReason:\n" << getReason(ban.reason).c_str() << ".\nComment:\n" << ban.comment.c_str() << ".\nYour " << (deletion ? "account won't be undeleted" : "banishment will be lifted at:\n") << (deletion ? "" : formatDateEx(ban.expires).c_str()); disconnectClient(0x0A, ss.str().c_str()); return; } // remove premium days #ifndef __LOGIN_SERVER__ IOLoginData::getInstance()->removePremium(account); if(!g_config.getBool(ConfigManager::ACCOUNT_MANAGER) && !account.charList.size()) { disconnectClient(0x0A, std::string("This account does not contain any character yet.\nCreate a new character on the " + g_config.getString(ConfigManager::SERVER_NAME) + " website at " + g_config.getString(ConfigManager::URL) + ".").c_str()); return; } #else Characters charList; for(Characters::iterator it = account.charList.begin(); it != account.charList.end(); ++it) { if(version >= it->second.server->getVersionMin() && version <= it->second.server->getVersionMax()) charList[it->first] = it->second; } IOLoginData::getInstance()->removePremium(account); if(!g_config.getBool(ConfigManager::ACCOUNT_MANAGER) && !charList.size()) { disconnectClient(0x0A, std::string("This account does not contain any character on this client yet.\nCreate a new character on the " + g_config.getString(ConfigManager::SERVER_NAME) + " website at " + g_config.getString(ConfigManager::URL) + ".").c_str()); return; } #endif ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, true); if(OutputMessage_ptr output = OutputMessagePool::getInstance()->getOutputMessage(this, false)) { TRACK_MESSAGE(output); output->put<char>(0x14); uint32_t serverIp = serverIps.front().first; for(std::list<std::pair<uint32_t, uint32_t> >::iterator it = serverIps.begin(); it != serverIps.end(); ++it) { if((it->first & it->second) != (clientIp & it->second)) continue; serverIp = it->first; break; } char motd[1300]; sprintf(motd, "%d\n%s", g_game.getMotdId(), g_config.getString(ConfigManager::MOTD).c_str()); output->putString(motd); //Add char list output->put<char>(0x64); if(g_config.getBool(ConfigManager::ACCOUNT_MANAGER) && account.number != 1) { output->put<char>(account.charList.size() + 1); output->putString("Account Manager"); output->putString(g_config.getString(ConfigManager::SERVER_NAME)); output->put<uint32_t>(serverIp); output->put<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT)); } else output->put<char>((uint8_t)account.charList.size()); #ifndef __LOGIN_SERVER__ for(Characters::iterator it = account.charList.begin(); it != account.charList.end(); ++it) { output->putString((*it)); if(g_config.getBool(ConfigManager::ON_OR_OFF_CHARLIST) && !g_config.getBool(ConfigManager::CHARLIST_INFO)) { if(g_game.getPlayerByName((*it))) output->putString("Online"); else output->putString("Offline"); } else if(g_config.getBool(ConfigManager::CHARLIST_INFO)) { std::stringstream str; Player *player = g_game.getPlayerByName((*it)); bool v = false; if(g_config.getBool(ConfigManager::ON_OR_OFF_CHARLIST)) { if(player) str << "On"; else str << "Off"; str << "/"; } if(!player) { v = true; player = g_game.getPlayerByNameEx((*it)); } str << player->getLevel(); str << "/"; str << player->getVocation()->getName(); output->putString(str.str()); if(v) delete player; } else output->putString(g_config.getString(ConfigManager::SERVER_NAME)); output->put<uint32_t>(serverIp); output->put<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT)); } #else for(Characters::iterator it = charList.begin(); it != charList.end(); ++it) { output->putString(it->second.name); if(!g_config.getBool(ConfigManager::ON_OR_OFF_CHARLIST) || it->second.status < 0) output->putString(it->second.server->getName()); else if(it->second.status) output->putString("Online"); else output->putString("Offline"); output->put<uint32_t>(it->second.server->getAddress()); IntegerVec games = it->second.server->getPorts(); output->put<uint16_t>(games[random_range(0, games.size() - 1)]); } #endif //Add premium days if(g_config.getBool(ConfigManager::FREE_PREMIUM)) output->put<uint16_t>(GRATIS_PREMIUM); else output->put<uint16_t>(account.premiumDays); OutputMessagePool::getInstance()->send(output); } getConnection()->close(); }
string TransferAbortedEvent::toString() const { return className + ": transfer of bundle " + _bundle.toString() + " to " + _peer.getString() + " aborted. (" + getReason(reason) + ")"; }
//If we get back an error (not found, etc...), handle it here void FSLSLBridgeRequestResponder::httpFailure() { LL_WARNS() << "FSLSLBridgeRequest::error(" << getStatus() << ": " << getReason() << ")" << LL_ENDL; }
bool ProtocolLogin::parseFirstPacket(NetworkMessage& msg) { if(server.game().getGameState() == GAME_STATE_SHUTDOWN) { getConnection()->close(); return false; } uint32_t clientIp = getConnection()->getIP(); /*uint16_t operatingSystem = msg.GetU16();*/msg.SkipBytes(2); uint16_t version = msg.GetU16(); msg.SkipBytes(12); if(!RSA_decrypt(msg)) { getConnection()->close(); return false; } uint32_t key[4] = {msg.GetU32(), msg.GetU32(), msg.GetU32(), msg.GetU32()}; enableXTEAEncryption(); setXTEAKey(key); std::string name = msg.GetString(), password = msg.GetString(); if(name.empty()) { if(!server.configManager().getBool(ConfigManager::ACCOUNT_MANAGER)) { disconnectClient(0x0A, "Invalid account name."); return false; } name = "1"; password = "******"; } if(version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX) { disconnectClient(0x0A, CLIENT_VERSION_STRING); return false; } if(server.game().getGameState() < GAME_STATE_NORMAL) { disconnectClient(0x0A, "Server is just starting up, please wait."); return false; } if(server.game().getGameState() == GAME_STATE_MAINTAIN) { disconnectClient(0x0A, "Server is under maintenance, please re-connect in a while."); return false; } if(ConnectionManager::getInstance()->isDisabled(clientIp, protocolId)) { disconnectClient(0x0A, "Too many connections attempts from your IP address, please try again later."); return false; } if(IOBan::getInstance()->isIpBanished(clientIp)) { disconnectClient(0x0A, "Your IP is banished!"); return false; } uint32_t id = 1; if(!IOLoginData::getInstance()->getAccountId(name, id)) { ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, false); disconnectClient(0x0A, "Invalid account name."); return false; } AccountP account = IOLoginData::getInstance()->loadAccount(id); if (account == nullptr) { disconnectClient(0x0A, "Invalid account name."); return false; } if(!encryptTest(password, account->getPassword())) { ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, false); disconnectClient(0x0A, "Invalid password."); return false; } Ban ban; ban.value = account->getId(); ban.type = BAN_ACCOUNT; if(IOBan::getInstance()->getData(ban) && !IOLoginData::getInstance()->hasFlag(account->getId(), PlayerFlag_CannotBeBanned)) { bool deletion = ban.expires < 0; std::string name_ = "Automatic "; if(!ban.adminId) name_ += (deletion ? "deletion" : "banishment"); else IOLoginData::getInstance()->getNameByGuid(ban.adminId, name_, true); char buffer[500 + ban.comment.length()]; sprintf(buffer, "Your account has been %s at:\n%s by: %s,\nfor the following reason:\n%s.\nThe action taken was:\n%s.\nThe comment given was:\n%s.\nYour %s%s.", (deletion ? "deleted" : "banished"), formatDateShort(ban.added).c_str(), name_.c_str(), getReason(ban.reason).c_str(), getAction(ban.action, false).c_str(), ban.comment.c_str(), (deletion ? "account won't be undeleted" : "banishment will be lifted at:\n"), (deletion ? "." : formatDateShort(ban.expires, true).c_str())); disconnectClient(0x0A, buffer); return false; } const Account::Characters& characters = account->getCharacters(); if(!server.configManager().getBool(ConfigManager::ACCOUNT_MANAGER) && characters.empty()) { disconnectClient(0x0A, std::string("This account does not contain any character yet.\nCreate a new character on the " + server.configManager().getString(ConfigManager::SERVER_NAME) + " website at " + server.configManager().getString(ConfigManager::URL) + ".").c_str()); return false; } ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, true); if(OutputMessage_ptr output = OutputMessagePool::getInstance()->getOutputMessage(this, false)) { TRACK_MESSAGE(output); output->AddByte(0x14); char motd[1300]; sprintf(motd, "%d\n%s", server.game().getMotdId(), server.configManager().getString(ConfigManager::MOTD).c_str()); output->AddString(motd); uint32_t serverIp = serverIps[0].first; for(IpList::iterator it = serverIps.begin(); it != serverIps.end(); ++it) { if((it->first & it->second) != (clientIp & it->second)) continue; serverIp = it->first; break; } //Add char list output->AddByte(0x64); if(server.configManager().getBool(ConfigManager::ACCOUNT_MANAGER) && id != 1) { output->AddByte(characters.size() + 1); output->AddString("Account Manager"); output->AddString(server.configManager().getString(ConfigManager::SERVER_NAME)); output->AddU32(serverIp); output->AddU16(server.configManager().getNumber(ConfigManager::GAME_PORT)); } else output->AddByte((uint8_t)characters.size()); for (auto it = characters.cbegin(); it != characters.cend(); ++it) { auto& character = *it; #ifndef __LOGIN_SERVER__ output->AddString(character->getName()); output->AddString(character->getType()); output->AddU32(serverIp); output->AddU16(server.configManager().getNumber(ConfigManager::GAME_PORT)); #else if(version < it->second->getVersionMin() || version > it->second->getVersionMax()) continue; output->AddString(it->first); output->AddString(it->second->getName()); output->AddU32(it->second->getAddress()); output->AddU16(it->second->getPort()); #endif } Days premiumDays = account->getPremiumDays(); if (premiumDays.count() >= std::numeric_limits<uint16_t>::max()) { output->AddU16(std::numeric_limits<uint16_t>::max()); } else { output->AddU16(static_cast<uint16_t>(premiumDays.count())); } OutputMessagePool::getInstance()->send(output); } getConnection()->close(); return true; }