Exemple #1
0
    def handle_write(self):
        data = []

        while len(self.out) > 0:
            packet = self.out.pop(0)
            data.append(packet.build())

        self.send(''.join(data))
Exemple #2
0
    def handle_write(self):
        data = []

        while len(self.out) > 0:
            packet = self.out.pop(0)
            data.append(packet.build())

        self.send(''.join(data))
Exemple #3
0
    def handle_write(self):
        data = []

        # Send all packets in the queue.
        # XXX: Maybe limit this to a certain number of packets in case all the
        #      writing is holding up the rest of the thread.
        while len(self.packets) > 0:
            # Get the next packet to be sent.
            packet = self.packets.pop(0)
            # Pass the packet to the packet handler.
            if self.packet_handler:
                self.packet_handler(self, packet)
            # Forward the packet as long as it has not been suppressed.
            if not packet.suppressed:
                data.append(packet.build())

        # Send all the data that should be sent.
        self.send(''.join(data))