llsrv.cpp

Go to the documentation of this file.
00001 
00032 #include "llviewerprecompiledheaders.h"
00033 
00034 #include "llsrv.h"
00035 #include "llares.h"
00036 
00037 struct Responder : public LLAres::UriRewriteResponder
00038 {
00039         std::vector<std::string> mUris;
00040         void rewriteResult(const std::vector<std::string> &uris) {
00041                 for (size_t i = 0; i < uris.size(); i++)
00042                 {
00043                         llinfos << "[" << i << "] " << uris[i] << llendl;
00044                 }
00045                 mUris = uris;
00046         }
00047 };
00048 
00049 std::vector<std::string> LLSRV::rewriteURI(const std::string& uri)
00050 {
00051         LLPointer<Responder> resp = new Responder;
00052 
00053         gAres->rewriteURI(uri, resp);
00054         gAres->processAll();
00055 
00056         // It's been observed in deployment that c-ares can return control
00057         // to us without firing all of our callbacks, in which case the
00058         // returned vector will be empty, instead of a singleton as we
00059         // might wish.
00060 
00061         if (!resp->mUris.empty())
00062         {
00063                 return resp->mUris;
00064         }
00065 
00066         std::vector<std::string> uris;
00067         uris.push_back(uri);
00068         return uris;
00069 }

Generated on Fri May 16 08:34:01 2008 for SecondLife by  doxygen 1.5.5