Commit d3001d52b84fe0bdde5a5d9829e49f6ce54ddec6
- Date: Fri Apr 18 23:32:56 +0000 2008
- Committer: Johan Sørensen (johan@johansorensen.com)
- Author: Johan Sørensen (johan@johansorensen.com)
- Commit SHA1: d3001d52b84fe0bdde5a5d9829e49f6ce54ddec6
- Tree SHA1: 00f9159f398bd07da4dc4805d6058533764035f5
back out of non-blocking Socket#accept
Commit diff
| |   |
| 43 | 43 | end |
| 44 | 44 | |
| 45 | 45 | def run |
| 46 | | begin |
| 47 | | while session = @socket.accept_nonblock |
| 48 | | connections = $children_active - $children_reaped |
| 49 | | if connections > MAX_CHILDREN |
| 50 | | log(Process.pid, "too many active children #{connections}/#{MAX_CHILDREN}") |
| 51 | | session.close |
| 52 | | next |
| 53 | | end |
| 54 | | |
| 55 | | run_service(session) |
| 46 | while session = @socket.accept |
| 47 | connections = $children_active - $children_reaped |
| 48 | if connections > MAX_CHILDREN |
| 49 | log(Process.pid, "too many active children #{connections}/#{MAX_CHILDREN}") |
| 50 | session.close |
| 51 | next |
| 56 | 52 | end |
| 57 | | rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR |
| 58 | | IO.select([@socket]) |
| 59 | | retry |
| 53 | |
| 54 | run_service(session) |
| 60 | 55 | end |
| 61 | 56 | end |
| 62 | 57 | |
| toggle raw diff |
--- a/script/git-daemon
+++ b/script/git-daemon
@@ -43,20 +43,15 @@ module Git
end
def run
- begin
- while session = @socket.accept_nonblock
- connections = $children_active - $children_reaped
- if connections > MAX_CHILDREN
- log(Process.pid, "too many active children #{connections}/#{MAX_CHILDREN}")
- session.close
- next
- end
-
- run_service(session)
+ while session = @socket.accept
+ connections = $children_active - $children_reaped
+ if connections > MAX_CHILDREN
+ log(Process.pid, "too many active children #{connections}/#{MAX_CHILDREN}")
+ session.close
+ next
end
- rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
- IO.select([@socket])
- retry
+
+ run_service(session)
end
end
|