Permalink
Browse files

better error handling, accepts a port to start on

  • Loading branch information...
1 parent e6d6ac1 commit 25a0bc70fd4c0b23900e5ac280ca8a2d97740040 @schacon committed Sep 7, 2009
Showing with 16 additions and 13 deletions.
  1. +1 −1 bin/agit-daemon
  2. +15 −12 dulwich/server.py
View
@@ -6,5 +6,5 @@ from dulwich.agitmemnon import *
if __name__ == "__main__":
backend = AgitmemnonBackend()
- server = TCPGitServer(backend, '0.0.0.0')
+ server = TCPGitServer(backend, '0.0.0.0', int(sys.argv[1]))
server.serve_forever()
View
@@ -222,19 +222,22 @@ def handle(self):
class TCPGitRequestHandler(SocketServer.StreamRequestHandler):
def handle(self):
- proto = Protocol(self.rfile.read, self.wfile.write)
- command, args = proto.read_cmd()
-
- # switch case to handle the specific git command
- if command == 'git-upload-pack':
- cls = UploadPackHandler
- elif command == 'git-receive-pack':
- cls = ReceivePackHandler
- else:
- return
+ try:
+ proto = Protocol(self.rfile.read, self.wfile.write)
+ command, args = proto.read_cmd()
+
+ # switch case to handle the specific git command
+ if command == 'git-upload-pack':
+ cls = UploadPackHandler
+ elif command == 'git-receive-pack':
+ cls = ReceivePackHandler
+ else:
+ return
- h = cls(self.server.backend, self.rfile.read, self.wfile.write, args)
- h.handle()
+ h = cls(self.server.backend, self.rfile.read, self.wfile.write, args)
+ h.handle()
+ except:
+ pass
class TCPGitServer(SocketServer.TCPServer):

0 comments on commit 25a0bc7

Please sign in to comment.