request.Request.SUBMITTED

Here are the examples of the python api request.Request.SUBMITTED taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: mfp Source File: rpc_host.py
Function: put
    def put(self, req, peer_id):
        from datetime import datetime

        # find the right socket 
        sock = self.managed_sockets.get(peer_id)
        if sock is None: 
            print "[%s] RPCHost.put: peer_id %s has no mapped socket" % (datetime.now(),
                                                                         peer_id)
            print req.serialize()
            raise Exception()
    
        # is this a request?  if so, put it in the pending dict 
        if req.method is not None:
            self.pending[req.request_id] = req
            req.state = Request.SUBMITTED 

        # write the data to the socket 
        try:
            jdata = req.serialize()
            with self.lock: 
                sock.send(self.SYNC_MAGIC)
                sock.send("% 8d" % len(jdata))
                sock.send(jdata)
        except Exception, e:
            print "[%s] RPCHost.put: SEND error: %s" % (datetime.now(), e)
            print req
            raise Exception()