def Freezed(): """Connects to Fleetspeak, then sleeps indefinitely.""" logging.info("starting freezed") con = clib.FleetspeakConnection(version="0.5") logging.info("connection created") while True: time.sleep(1)
def __init__(self): self._fs = fs_client.FleetspeakConnection( version=config.CONFIG["Source.version_string"]) self._sender_queue = Queue.Queue( maxsize=GRRFleetspeakClient._SENDER_QUEUE_MAXSIZE) self._threads = {} # TODO(amoser): Once the Fleetspeak nanny functionality is # production ready, change this to # internal_nanny_monitoring=False # heart_beat_cb=self._fs.Heartbeat internal_nanny_monitoring = True heart_beat_cb = None # The client worker does all the real work here. # In particular, we delegate sending messages to Fleetspeak to a separate # threading.Thread here. self._threads["Worker"] = comms.GRRClientWorker( out_queue=_FleetspeakQueueForwarder(self._sender_queue), start_worker_thread=False, heart_beat_cb=heart_beat_cb, internal_nanny_monitoring=internal_nanny_monitoring, client=self) self._threads["Foreman"] = self._CreateThread(self._ForemanOp) self._threads["Sender"] = self._CreateThread(self._SendOp) self._threads["Receiver"] = self._CreateThread(self._ReceiveOp)
def Loopback(): logging.info("starting loopback") con = clib.FleetspeakConnection() logging.info("connection created") while True: msg, _ = con.Recv() msg.message_type += "Response" con.Send(msg)
def Heartbeat(): """Sends a heartbeat every second, indefinitely.""" logging.info("starting heartbeat") con = clib.FleetspeakConnection(version="0.5") logging.info("connection created") while True: time.sleep(1) con.Heartbeat()
def MemoryHog(): """Takes 20MB of memory, then sleeps forever.""" logging.info("starting memory leak") con = clib.FleetspeakConnection(version="0.5") logging.info("connection created") buf = "a" * (1024 * 1024 * 20) while True: time.sleep(1)
def __init__(self): self._fs = fs_client.FleetspeakConnection() self._sender_queue = Queue.Queue( maxsize=GRRFleetspeakClient._SENDER_QUEUE_MAXSIZE) # The client worker does all the real work here. # In particular, we delegate sending messages to Fleetspeak to a separate # threading.Thread here. self._client_worker = comms.GRRThreadedWorker( out_queue=_FleetspeakQueueForwarder(self._sender_queue), start_worker_thread=False)
def __init__(self): self._fs = fs_client.FleetspeakConnection() self._sender_queue = Queue.Queue( maxsize=GRRFleetspeakClient._SENDER_QUEUE_MAXSIZE) self._threads = {} # The client worker does all the real work here. # In particular, we delegate sending messages to Fleetspeak to a separate # threading.Thread here. self._threads["Worker"] = comms.GRRThreadedWorker( out_queue=_FleetspeakQueueForwarder(self._sender_queue), start_worker_thread=False, client=self) self._threads["Foreman"] = self._CreateThread(self._ForemanOp) self._threads["Sender"] = self._CreateThread(self._SendOp) self._threads["Receiver"] = self._CreateThread(self._ReceiveOp)