Changeset 2287 for research/2008-displacement/main-cpushare
- Timestamp:
- Apr 16, 2008, 12:11:35 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
research/2008-displacement/main-cpushare
r2286 r2287 18 18 sys.exit(-1) 19 19 mode = sys.argv[2][1] 20 done = 0 20 21 source = sys.argv[3:] 21 22 result = [False] * len(source) … … 35 36 global todo, source 36 37 if todo >= len(source): 37 return # We're finished... FIXME: a process is stuck38 return # We're finished... FIXME: is the transaction kept stuck? 38 39 self.index = todo 39 40 todo += 1 40 41 gd.gdMaxColors = 256 * 256 * 256 41 42 im = gd.image(source[self.index]) 42 # Send mode 43 self.protocol.sendString(PROTO_SECCOMP_FORWARD + mode) 43 # Send argument count 44 self.protocol.sendString(PROTO_SECCOMP_FORWARD + chr(3)) 45 # Send arguments 46 msg = chr(3) 47 msg += "bytecode\0" 48 msg += "-1\0" 49 msg += source[self.index] + "\0" 50 self.protocol.sendString(PROTO_SECCOMP_FORWARD + msg) 44 51 # Send image size 45 52 (self.w, self.h) = (w, h) = im.size() … … 65 72 if ord(self.answer[-1]) != 0: 66 73 return 67 global result74 global done, result 68 75 result[self.index] = self.answer[:-1] 69 76 print self.answer[:-1], 70 77 self.protocol.sendString(PROTO_SECCOMP_SUCCESS) 71 # the PROTO_SECCOMP_SUCCESS probably won't have a chance72 # to go out but it doesn't matter because we'll disconnect73 # not just this but all other seccomp state machines too78 done += 1 79 if done < len(source): 80 return 74 81 from twisted.internet import reactor 75 82 reactor.stop()
Note: See TracChangeset
for help on using the changeset viewer.