On Sat, Jul 22, 2006 at 12:26:36AM +0900, Kobayashi Noritada wrote:
> +    begin
> +      50.times do |n|
> +        TCPServer.new(port).close
> +        sleep 0.1 + rand(0.2)
> +      end
> +      teardown_svnserve
> +      false
> +    rescue Errno::EADDRINUSE
> +      true
> +    end

I don't think it is actually a good thing to do it this way. You're only
replacing one race by another one; if svnserve just happens to try to
bind to the port between the time you open your port from ruby and the
moment you close it again, you've got the same (or at least, a similar)
problem. Since you're not staying in sleep() for very long, chances of
this occurring are actually pretty high.

Isn't there a way for svnserve to signal somehow that the port is
opened? Like, say, "create a PID file once the daemon is listening, and
not before"?

-- 
Fun will now commence
  -- Seven Of Nine, "Ashes to Ashes", stardate 53679.4


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to