next_service (Discovery)

    # File lib/yadis/manager.rb, line 44
      def next_service
        manager = self.get_manager
        if manager and manager.length <= 0
          self.destroy_manager
          manager = nil
        end

        unless manager
          begin
            yadis_url, services = self.discover
          rescue YADISParseError, YADISHTTPError
            manager = nil
          else
            manager = self.create_manager(services, yadis_url)
          end
        end

        if manager
          service = manager.next
          self.store_manager(manager)
        else
          service = nil
        end

        return service
      end