def main_loop(listener, work_queue):
    """Wait for connections and process them.
    @param listener: a socket.socket, open and listening.
    """

    while True:
        conn, _ = listener.accept()
        data = conn.makefile().read()
        conn.close()

        work_queue.put(data)