本文整理汇总了C++中LLHost::isOk方法的典型用法代码示例。如果您正苦于以下问题:C++ LLHost::isOk方法的具体用法?C++ LLHost::isOk怎么用?C++ LLHost::isOk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLHost
的用法示例。
在下文中一共展示了LLHost::isOk方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startSOCKSProxy
/**
* @brief Initiates a SOCKS 5 proxy session.
*
* Performs basic checks on host to verify that it is a valid address. Opens the control channel
* and then negotiates the proxy connection with the server. Closes any existing SOCKS
* connection before proceeding. Also disables an HTTP proxy if it is using SOCKS as the proxy.
*
*
* @param host Socks server to connect to.
* @return SOCKS_OK if successful, otherwise a SOCKS error code defined in llproxy.h.
*/
S32 LLProxy::startSOCKSProxy(LLHost host)
{
if (host.isOk())
{
mTCPProxy = host;
}
else
{
return SOCKS_INVALID_HOST;
}
// Close any running SOCKS connection.
stopSOCKSProxy();
mProxyControlChannel = tcp_open_channel(mTCPProxy);
if (!mProxyControlChannel)
{
return SOCKS_HOST_CONNECT_FAILED;
}
S32 status = proxyHandshake(mTCPProxy);
if (status != SOCKS_OK)
{
// Shut down the proxy if any of the above steps failed.
stopSOCKSProxy();
}
else
{
// Connection was successful.
sUDPProxyEnabled = true;
}
return status;
}
示例2: enableHTTPProxy
/**
* @brief Enable the HTTP proxy for either SOCKS or HTTP.
*
* Check the supplied host to see if it is a valid IP and port.
*
* @param httpHost Proxy server to connect to.
* @param type Is the host a SOCKS or HTTP proxy.
* @return Return true if applying the setting was successful. No changes are made if false.
*/
bool LLProxy::enableHTTPProxy(LLHost httpHost, LLHttpProxyType type)
{
if (!httpHost.isOk())
{
LL_WARNS("Proxy") << "Invalid SOCKS 5 Server" << LL_ENDL;
return false;
}
LLMutexLock lock(&mProxyMutex);
mHTTPProxy = httpHost;
mProxyType = type;
mHTTPProxyEnabled = true;
return true;
}
示例3: getInvItemAsset
void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,
const LLUUID &owner_id, const LLUUID &task_id, const LLUUID &item_id,
const LLUUID &asset_id, LLAssetType::EType atype,
LLGetAssetCallback callback, void *user_data, BOOL is_priority)
{
lldebugs << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << llendl;
//
// Probably will get rid of this early out?
//
//if (asset_id.isNull())
//{
// // Special case early out for NULL uuid
// if (callback)
// {
// callback(mVFS, asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE);
// }
// return;
//}
bool exists = false;
U32 size = 0;
if(asset_id.notNull())
{
exists = mVFS->getExists(asset_id, atype);
LLVFile file(mVFS, asset_id, atype);
size = exists ? file.getSize() : 0;
if(exists && size < 1)
{
llwarns << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << llendl;
file.remove();
}
}
if (size < 1)
{
// See whether we should talk to the object's originating sim,
// or the upstream provider.
LLHost source_host;
if (object_sim.isOk())
{
source_host = object_sim;
}
else
{
source_host = mUpstreamHost;
}
if (source_host.isOk())
{
// stash the callback info so we can find it after we get the response message
LLInvItemRequest *req = new LLInvItemRequest(asset_id, atype);
req->mDownCallback = callback;
req->mUserData = user_data;
req->mIsPriority = is_priority;
// send request message to our upstream data provider
// Create a new asset transfer.
LLTransferSourceParamsInvItem spi;
spi.setAgentSession(agent_id, session_id);
spi.setInvItem(owner_id, task_id, item_id);
spi.setAsset(asset_id, atype);
// Set our destination file, and the completion callback.
LLTransferTargetParamsVFile tpvf;
tpvf.setAsset(asset_id, atype);
tpvf.setCallback(downloadInvItemCompleteCallback, req);
llinfos << "Starting transfer for inventory asset "
<< item_id << " owned by " << owner_id << "," << task_id
<< llendl;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
ttcp->requestTransfer(spi, tpvf, 100.f + (is_priority ? 1.f : 0.f));
}
else
{
// uh-oh, we shouldn't have gotten here
llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl;
if (callback)
{
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
}
else
{
// we've already got the file
// theoretically, partial files w/o a pending request shouldn't happen
// unless there's a weird error
if (callback)
{
callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
}
}
}
示例4:
void host_object::test<1>()
{
LLHost host;
ensure("IP address is not NULL", (0 == host.getAddress()) && (0 == host.getPort()) && !host.isOk());
}
示例5: getEstateAsset
void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,
const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype,
LLGetAssetCallback callback, void *user_data, BOOL is_priority)
{
LL_DEBUGS() << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << LL_ENDL;
//
// Probably will get rid of this early out?
//
if (asset_id.isNull())
{
// Special case early out for NULL uuid
if (callback)
{
callback(mVFS, asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID);
}
return;
}
// Try static VFS first.
if (findInStaticVFSAndInvokeCallback(asset_id,atype,callback,user_data))
{
return;
}
BOOL exists = mVFS->getExists(asset_id, atype);
LLVFile file(mVFS, asset_id, atype);
U32 size = exists ? file.getSize() : 0;
if (size > 0)
{
// we've already got the file
// theoretically, partial files w/o a pending request shouldn't happen
// unless there's a weird error
if (callback)
{
callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
}
}
else
{
if (exists)
{
LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
file.remove();
}
// See whether we should talk to the object's originating sim, or the upstream provider.
LLHost source_host;
if (object_sim.isOk())
{
source_host = object_sim;
}
else
{
source_host = mUpstreamHost;
}
if (source_host.isOk())
{
// stash the callback info so we can find it after we get the response message
LLEstateAssetRequest *req = new LLEstateAssetRequest(asset_id, atype, etype);
req->mDownCallback = callback;
req->mUserData = user_data;
req->mIsPriority = is_priority;
// send request message to our upstream data provider
// Create a new asset transfer.
LLTransferSourceParamsEstate spe;
spe.setAgentSession(agent_id, session_id);
spe.setEstateAssetType(etype);
// Set our destination file, and the completion callback.
LLTransferTargetParamsVFile tpvf;
tpvf.setAsset(asset_id, atype);
tpvf.setCallback(downloadEstateAssetCompleteCallback, req);
LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << LL_ENDL;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
ttcp->requestTransfer(spe, tpvf, 100.f + (is_priority ? 1.f : 0.f));
}
else
{
// uh-oh, we shouldn't have gotten here
LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
if (callback)
{
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
}
}