예제 #1
0
파일: base.py 프로젝트: longde123/fmspy
 def _first_ping(self):
     """
     Send first ping, usually after first connect.
     """
     self.pushPacket(
         Ping(Ping.UNKNOWN_8,
              [0, 1, int(_time.seconds() * 1000) & 0x7fffffff]))
예제 #2
0
파일: base.py 프로젝트: longde123/fmspy
 def __init__(self):
     """
     Constructor.
     """
     RTMPBaseProtocol.__init__(self)
     self.bytesReceived = 0
     self.lastReceived = _time.seconds()
     self.pingTask = None
     self.nextInvokeId = 2.0
     self.invokeReplies = {}
예제 #3
0
파일: base.py 프로젝트: Xkeeper/fmspy
 def __init__(self):
     """
     Constructor.
     """
     RTMPBaseProtocol.__init__(self)
     self.bytesReceived = 0
     self.lastReceived = _time.seconds()
     self.pingTask = None
     self.nextInvokeId = 2.0
     self.invokeReplies = {}
예제 #4
0
파일: base.py 프로젝트: longde123/fmspy
    def dataReceived(self, data):
        """
        Some data was received from peer.

        @param data: bytes received
        @type data: C{str}
        """
        self.lastReceived = _time.seconds()
        self.bytesReceived += len(data)

        RTMPBaseProtocol.dataReceived(self, data)
예제 #5
0
파일: base.py 프로젝트: Xkeeper/fmspy
    def _pinger(self):
        """
        Regular 'ping' service.

        We send 'pings' to other end of RTMP protocol, expecting to receive
        'pong'. If we receive some data, we assume 'ping' is sent. If other end
        of protocol doesn't send anything in reply to our 'ping' for some timeout,
        we disconnect connection.
        """
        noDataInterval = _time.seconds() - self.lastReceived

        if noDataInterval > config.getint('RTMP', 'keepAliveTimeout'):
            log.msg('Closing connection due too much inactivity (%d)' % noDataInterval)
            self.transport.loseConnection()
            return

        if noDataInterval > config.getint('RTMP', 'pingInterval'):
            self.pushPacket(Ping(Ping.PING_CLIENT, [int(_time.seconds()*1000) & 0x7fffffff]))

        self.pushPacket(BytesRead(self.bytesReceived))
예제 #6
0
파일: base.py 프로젝트: Xkeeper/fmspy
    def dataReceived(self, data):
        """
        Some data was received from peer.

        @param data: bytes received
        @type data: C{str}
        """
        self.lastReceived = _time.seconds()
        self.bytesReceived += len(data)

        RTMPBaseProtocol.dataReceived(self, data)
예제 #7
0
파일: base.py 프로젝트: longde123/fmspy
    def _pinger(self):
        """
        Regular 'ping' service.

        We send 'pings' to other end of RTMP protocol, expecting to receive
        'pong'. If we receive some data, we assume 'ping' is sent. If other end
        of protocol doesn't send anything in reply to our 'ping' for some timeout,
        we disconnect connection.
        """
        noDataInterval = _time.seconds() - self.lastReceived

        if noDataInterval > config.getint('RTMP', 'keepAliveTimeout'):
            log.msg('Closing connection due too much inactivity (%d)' %
                    noDataInterval)
            self.transport.loseConnection()
            return

        if noDataInterval > config.getint('RTMP', 'pingInterval'):
            self.pushPacket(
                Ping(Ping.PING_CLIENT,
                     [int(_time.seconds() * 1000) & 0x7fffffff]))

        self.pushPacket(BytesRead(self.bytesReceived))
예제 #8
0
파일: base.py 프로젝트: Xkeeper/fmspy
 def _first_ping(self):
     """
     Send first ping, usually after first connect.
     """
     self.pushPacket(Ping(Ping.UNKNOWN_8, [0, 1, int(_time.seconds()*1000) & 0x7fffffff]))