def dispatcherProcess(commqueue, controls): #A process that handles requests request = commqueue.get() while not request == CMD_HALT: #print(request) try: handlerList[request.getType()](request, controls) except DeadWorkerError as error: commqueue.put(Request(CMD_WORKER_DIED, {"WORKER": error.id})) request.close() request = commqueue.get()
def requestHandler(request): handlers[request.getType()](request) request.close()