Ejemplo n.º 1
0
 def sendPacket(self, target, context, request, records):
     """Send a raw packet to the specified target."""
     raw = flattenPacket(target,
                         context,
                         request,
                         records,
                         endianness=self.endianness)
     self.transport.write(raw)
Ejemplo n.º 2
0
 def flushCommands(self):
     while True:
         try:
             command = self.queue.get_nowait()
         except Queue.Empty:
             break
         if command is None:
             self.terminate('Connection closed')
             return False
         elif isinstance(command, str):
             # Hack to let us write raw data
             # to test error handling
             self.buffer += command
             continue
         target, context, flatrecs, future = command
         if future is None: # message
             request = 0
         else: # request
             request = self.startRequest(future)
         data = flattenPacket(target, context, request, flatrecs)
         self.buffer += data
     return True
Ejemplo n.º 3
0
 def sendPacket(self, target, context, request, records):
     """Send a raw packet to the specified target."""
     raw = flattenPacket(target, context, request, records, endianness=self.endianness)
     self.transport.write(raw)
Ejemplo n.º 4
0
 def sendPacket(self, target, context, request, records):
     """Send a raw packet to the specified target."""
     # FIXME: if transport.write() fails asynchronously, we need an errback
     # to generate an error response for the source.
     raw = flattenPacket(target, context, request, records, endianness=self.endian)
     self.transport.write(raw)