CSharpRTMP.Core.Protocols.Rtmfp.OutboundHandshake.OutboundHandshake C# (CSharp) Method

OutboundHandshake() public method

public OutboundHandshake ( BaseRtmfpProtocol handler ) : System
handler BaseRtmfpProtocol
return System
        public OutboundHandshake(BaseRtmfpProtocol handler)
            : base(new Peer(handler),Defines.RTMFP_SYMETRIC_KEY, Defines.RTMFP_SYMETRIC_KEY)
        {
            Handler = handler;
            _certificat = Utils.GenerateRandomBytes(76);
            Buffer.BlockCopy(CertificatInit, 0, _certificat, 0, 5);
            Buffer.BlockCopy(CertificatInit, 5, _certificat, 69, 7);
            _handshakeTimeoutTimer.Elapsed += (o, args) =>
            {
                if (_handshakeTimeoutTimer.Interval >= 3000)
                {
                    _handshakeTimeoutTimer.Interval = 1000;
                    _certificat = Utils.GenerateRandomBytes(76);
                    Buffer.BlockCopy(CertificatInit, 0, _certificat, 0, 5);
                    Buffer.BlockCopy(CertificatInit, 5, _certificat, 69, 7);
                    var rand = Utils.GenerateRandomBytes(16);
                    _handshake = () => HandShake30(rand);
                    HandShake30(rand);
                }
                else
                {
                    _handshake();
                    _handshakeTimeoutTimer.Interval += 1000;
                }
            };
        }