OLD | NEW |
1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 | 28 |
29 import os | 29 import os |
30 import SocketServer | 30 import SocketServer |
31 import stat | 31 import stat |
32 import subprocess | 32 import subprocess |
33 import threading | 33 import threading |
34 | 34 |
35 from . import compression | 35 from . import compression |
36 from . import constants | 36 from . import constants |
37 from . import discovery | |
38 from . import signatures | 37 from . import signatures |
39 from ..network import endpoint | 38 from ..network import endpoint |
40 from ..objects import workpacket | 39 from ..objects import workpacket |
41 | 40 |
42 | 41 |
43 class WorkHandler(SocketServer.BaseRequestHandler): | 42 class WorkHandler(SocketServer.BaseRequestHandler): |
44 | 43 |
45 def handle(self): | 44 def handle(self): |
46 rec = compression.Receiver(self.request) | 45 rec = compression.Receiver(self.request) |
47 while not rec.IsDone(): | 46 while not rec.IsDone(): |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 def _Call(self, cmd): | 129 def _Call(self, cmd): |
131 return subprocess.call(cmd, shell=True) | 130 return subprocess.call(cmd, shell=True) |
132 | 131 |
133 | 132 |
134 class WorkSocketServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): | 133 class WorkSocketServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): |
135 def __init__(self, daemon): | 134 def __init__(self, daemon): |
136 address = (daemon.ip, constants.PEER_PORT) | 135 address = (daemon.ip, constants.PEER_PORT) |
137 SocketServer.TCPServer.__init__(self, address, WorkHandler) | 136 SocketServer.TCPServer.__init__(self, address, WorkHandler) |
138 self.job_lock = threading.Lock() | 137 self.job_lock = threading.Lock() |
139 self.daemon = daemon | 138 self.daemon = daemon |
OLD | NEW |