def _start_networking(self):
        #print self, "_start_networking" # DEBUG
        super(SendImageRouterItem, self)._start_networking()

        self._transfer_service_transmitter = self._service_manager.register_service(
            DataSendService.protocol)

        self._transfer_service = DataSendService(self.name, self._link_manager,
            self._transfer_service_transmitter, self._dest_name)
class SendImageRouterItem(RouterItem):
    def __init__(self, name, dest_name, parent=None, enabled=True):
        self._dest_name = dest_name
        self._transfer_service = None
        self._transfer_service_transmitter = None
        super(SendImageRouterItem, self).__init__(name, parent, enabled)

    def _start_networking(self):
        #print self, "_start_networking" # DEBUG
        super(SendImageRouterItem, self)._start_networking()

        self._transfer_service_transmitter = self._service_manager.register_service(
            DataSendService.protocol)

        self._transfer_service = DataSendService(self.name, self._link_manager,
            self._transfer_service_transmitter, self._dest_name)

    def _stop_networking(self):
        #print self, "_stop_networking" # DEBUG
        super(SendImageRouterItem, self)._stop_networking()

        assert self._transfer_service is not None
        self._transfer_service.terminate()

        self._transfer_service = None

    def stop_data_transfer(self):
        self._transfer_service.reset_transfer_queue()

    def send_data(self, data_it):
        print "send_data" # DEBUG
        self._transfer_service.reset_transfer_queue()
        session_key = self._transfer_service.new_session()
        self._transfer_service.append_to_transfer_queue(data_it)

        return session_key