localshred/protobuf — pull request #125 by brianastien (2013-10-01 20:02:14+00:00)
Title: Prevent infinite loop when looking up services

Currently the service directory lookup has the potential to enter into an infinite loop if none of the servers in the listing are alive, and will only exit this loop is a server comes online. This pull request prevents an infinite loop from occurring and will abort the request on the client side after 5 seconds if a host is not found.

We first check all listings in a random order. If none are alive, we check the default server. If that is not alive, we retry 5 times, with a 1 second interval. Once we have tried for 5 seconds, we raise an error "Host not found".