On 4/19/2010 9:30 AM, Koen Deforche wrote:
> Hey Matt,
>
> 2010/4/19 Matt Gilg<[email protected]>:
>    
>> I could, but if it is true that the purpose of the resolver object is to
>> resolve a hostname to an address, it would break this functionality.  If
>> this was never supported, it may be worth changing the implementation.  I'd
>> need to hack for a couple minutes to get it to a releasable state, but if
>> this particular patch is of interest, I can generate it.
>>      
> It should only resolve hostnames that represent localhost, but it
> could be used to use the public DNS name of the localhost which
> resolves to a particular external IP address on which you want to
> sepcifically listen (instead of 0.0.0.0). Another typical case is to
> use "localhost" to resolve to 127.0.0.1 to only accept connections
> from localhost.
>
> So yes, I think it should resolve. I was assuming you were using a
> syntactical variant of the resolve() API or perhaps that we were
> misusing the boost asio interface... It does sound more like a proper
> bug in boost::asio or name resolution on your platform ?
>
> Regards,
> koen
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>    
I think that is likely true.  We still call the resolve() method, but 
I'm unsure of why a query is specified to retrieve the tcp_endpoint 
object. This might be a useful snippet of code:

     #ifdef GET_ADDRESS_OLD_WAY
       asio::ip::tcp::endpoint tcp_endpoint = *resolver.resolve(tcp_query);
       if (httpPort == "0")
         
tcp_endpoint.address(asio::ip::address::from_string(config.httpAddress()));
       else {
         asio::ip::tcp::resolver::query tcp_query(config.httpAddress(),
                    config.httpPort());
         tcp_endpoint = *resolver.resolve(tcp_query);
       }
       resolver.resolve(tcp_endpoint);
     #else // Manually create the endpoint.
       asio::ip::address addr = 
asio::ip::address::from_string(httpAddress.c_str);
       asio::ip::tcp::endpoint tcp_endpoint(addr, atoi(httpPort.c_str()));
       resolver.resolve(tcp_endpoint);
     #endif

Granted the lower section doesn't have any of the simple validation 
logic that exists in the previous code.  resolve() is called at the end 
in both places, but wt uses *resolver.resolve(tcp_query) to get the 
tcp::endpoint object in the 3.1.2 source.  I haven't dug deep enough to 
find out if building that query object has anything to do with name 
resolution.  It could be that it would work fine with our method, but I 
haven't tried it at this point.

-- 
Matt Gilg


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to