Beispiel #1
0
 def __init__(self, source=None, source_port=None, destination=None,
         destination_port=None, hops=0, *args, **kwargs):
     source = source or Node.me()
     source_port = source_port or settings.RTMP_PORT
     destination = destination or Node.me()
     super(Ticket, self).__init__(source=source, source_port=source_port,
             destination=destination, destination_port=destination_port,
             hops=hops, *args, **kwargs)
Beispiel #2
0
 def get(self, node_uuid=None):
     if not node_uuid:
         node = Node.get_by(uuid=Node.me().uuid)
     else:
         node = Node.get_by(uuid=node_uuid)
     if not node:
         raise tornado.web.HTTPError(404)
     self.write({'node': node.to_dict()})
Beispiel #3
0
 def get(self, node_uuid=None):
     if not node_uuid:
         node = Node.get_by(uuid=Node.me().uuid)
     else:
         node = Node.get_by(uuid=node_uuid)
     if not node:
         raise tornado.web.HTTPError(404)
     self.write({'node': node.to_dict()})
Beispiel #4
0
 def __init__(self,
              source=None,
              source_port=None,
              destination=None,
              destination_port=None,
              hops=0,
              *args,
              **kwargs):
     source = source or Node.me()
     source_port = source_port or settings.RTMP_PORT
     destination = destination or Node.me()
     super(Ticket, self).__init__(source=source,
                                  source_port=source_port,
                                  destination=destination,
                                  destination_port=destination_port,
                                  hops=hops,
                                  *args,
                                  **kwargs)
Beispiel #5
0
    def delete(self, node_uuid=None):
        """Remove the requesting node from the list of known nodes,
        unregistering the from the network.
        """

        if not node_uuid or node_uuid == Node.me().uuid:
            log.info("Shutting down because of request from %s",
                    self.request.remote_ip)
            tornado.ioloop.IOLoop.instance().stop()
            return

        node = Node.get_by(uuid=node_uuid)
        if node:
            closest_supernode = Node.closest_supernode()
            if closest_supernode and node != closest_supernode:
                log.info("Notifying closest supernode %s that %s was deleted",
                        closest_supernode, node)
                NodesAPI(closest_supernode.absolute_url()).unregister(node)
            if node == Node.me().primary_supernode and self.application.node:
                self.application.node.bootstrap()
            node.delete()
Beispiel #6
0
    def delete(self, node_uuid=None):
        """Remove the requesting node from the list of known nodes,
        unregistering the from the network.
        """

        if not node_uuid or node_uuid == Node.me().uuid:
            log.info("Shutting down because of request from %s",
                     self.request.remote_ip)
            tornado.ioloop.IOLoop.instance().stop()
            return

        node = Node.get_by(uuid=node_uuid)
        if node:
            closest_supernode = Node.closest_supernode()
            if closest_supernode and node != closest_supernode:
                log.info("Notifying closest supernode %s that %s was deleted",
                         closest_supernode, node)
                NodesAPI(closest_supernode.absolute_url()).unregister(node)
            if node == Node.me().primary_supernode and self.application.node:
                self.application.node.bootstrap()
            node.delete()
Beispiel #7
0
    def queue_tunnel_creation(self):
        """Since Astral is a "pull" system, the person receiving a forwarded
        stream from us based on this ticket (the destination) is in charge of
        connecting to us - we don't explicitly send anything to them.

        This will queue the node up to create a tunnel from the source's RTMP
        server to a port on the local node. If we created this ticket for
        ourselves, we will just connect to it from the browser. If it was
        created in response to a request from another node (i.e. the destination
        is not us), we don't create any extra tunnels. A tunnel will already
        exist in that case to bring the stream from somewhere else to here.
        """
        if self.confirmed and self.destination == Node.me():
            TUNNEL_QUEUE.put(self)
Beispiel #8
0
    def queue_tunnel_creation(self):
        """Since Astral is a "pull" system, the person receiving a forwarded
        stream from us based on this ticket (the destination) is in charge of
        connecting to us - we don't explicitly send anything to them.

        This will queue the node up to create a tunnel from the source's RTMP
        server to a port on the local node. If we created this ticket for
        ourselves, we will just connect to it from the browser. If it was
        created in response to a request from another node (i.e. the destination
        is not us), we don't create any extra tunnels. A tunnel will already
        exist in that case to bring the stream from somewhere else to here.
        """
        if self.confirmed and self.destination == Node.me():
            TUNNEL_QUEUE.put(self)