celluloid / celluloid-io

UNMAINTAINED: See celluloid/celluloid#779 - Evented sockets for Celluloid actors
https://celluloid.io
MIT License
879 stars 93 forks source link

DNSResolver: fix crash when networking is disabled and not needed #116

Closed paddor closed 9 years ago

paddor commented 9 years ago

This commit fixes the issue when "localhost" is tried to be resolved where it used to fail when networking on Mac OSX is disabled. When it's disabled, the file /etc/resolv.conf doesn't exist and thus the method Celluloid::IO::DNSResolver.nameservers returns nil, which shouldn't be a problem because networking isn't really needed to resolve "localhost". It can use static lookup with /etc/hosts.

tarcieri commented 9 years ago

This blows away all of the caching the instance variables are trying to do, and greatly increases the complexity of the resolve method.

paddor commented 9 years ago

I hope this is better. I know, it's still not beautiful. I can't come up with a better solution.

tarcieri commented 9 years ago

Seems ok :thumbsup: