コード例 #1
0
void ASIOSocketWrapper::sendManyDequeItems(const std::tr1::weak_ptr<MultiplexedSocket>&weakParentMultiSocket, const ErrorCode &error, std::size_t bytes_sent) {
    MultiplexedSocketPtr parentMultiSocket(weakParentMultiSocket.lock());
    mOutstandingDataParent.reset();

    if (parentMultiSocket) {
        std::deque<TimestampedChunk> local_toSend;
        local_toSend.swap(mToSend);
        if (error )   {
            triggerMultiplexedConnectionError(&*parentMultiSocket,this,error);
            SILOG(tcpsst,insane,"Socket disconnected...waiting for recv to trigger error condition\n");
        } else {
            size_t total_size=0;
            for (std::deque<TimestampedChunk>::const_iterator i=local_toSend.begin(),ie=local_toSend.end(); i!=ie; ++i) {
                finishedSendingChunk(*i);
                size_t cursize=i->size();
                total_size+=cursize;
                if (cursize) {
                    BufferPrint(this,".sec",&*i->chunk->begin(),cursize);
                    TCPSSTLOG(this,"snd",&*i->begin(),i->size,error);
                }
                delete i->chunk;
            }
            assert(total_size==bytes_sent);//otherwise should have given us an error
            //and send further items on the global queue if they are there
            finishAsyncSend(parentMultiSocket);
        }
    }
}
コード例 #2
0
void AssetDownloadTask::weakTextureDownloaded(const std::tr1::weak_ptr<AssetDownloadTask>& thus, Transfer::URI uri, ResourceDownloadTaskPtr taskptr,
        Transfer::TransferRequestPtr request, Transfer::DenseDataPtr response) {
    std::tr1::shared_ptr<AssetDownloadTask>locked(thus.lock());
    if (locked) {
        locked->textureDownloaded(uri, taskptr, request, response);
    }
}
コード例 #3
0
void AssetDownloadTask::weakAssetFileDownloaded(std::tr1::weak_ptr<AssetDownloadTask> thus, ResourceDownloadTaskPtr taskptr,
        Transfer::TransferRequestPtr request, Transfer::DenseDataPtr response) {
    std::tr1::shared_ptr<AssetDownloadTask> locked(thus.lock());
    if (locked){
        locked->assetFileDownloaded(taskptr, std::tr1::static_pointer_cast<Transfer::ChunkRequest, Transfer::TransferRequest>(request),response);
    }
}
コード例 #4
0
void TopLevelSpaceConnection::connectToAddress(const std::tr1::weak_ptr<TopLevelSpaceConnection>&weak_thus,ObjectHost*oh,const Network::Address*addy) {
    std::tr1::shared_ptr<TopLevelSpaceConnection>thus=weak_thus.lock();
    if (thus) {
        thus->mParent=oh;
        if (addy) {
            thus->mTopLevelStream->connect(*addy);
            oh->insertAddressMapping(*addy,thus);
        }else {
            thus->mTopLevelStream->connect(Network::Address("0.0.0.0","0"));
        }
    }
}
コード例 #5
0
 static void timedOut(
         const boost::system::error_code &error,
         std::tr1::weak_ptr<TimerHandle> wthis)
 {
     std::tr1::shared_ptr<TimerHandle> sharedThis (wthis.lock());
     if (!sharedThis) {
         return; // we've been deleted already.
     }
     if (error == boost::asio::error::operation_aborted) {
         return; // don't care if the timer was cancelled.
     }
     sharedThis->mFunc();
 }
コード例 #6
0
void AssetDownloadTask::weakAssetFileDownloaded(std::tr1::weak_ptr<AssetDownloadTask> thus, std::tr1::shared_ptr<ChunkRequest> request, std::tr1::shared_ptr<const DenseData> response) {
    std::tr1::shared_ptr<AssetDownloadTask> locked(thus.lock());
    if (locked){
        locked->assetFileDownloaded(request,response);
    }
}
コード例 #7
0
void AssetDownloadTask::weakHandleAssetParsed(std::tr1::weak_ptr<AssetDownloadTask> thus, Mesh::MeshdataPtr md){
    std::tr1::shared_ptr<AssetDownloadTask> locked(thus.lock());
    if (locked){
        locked->handleAssetParsed(md);
    }
}