[rtmpdump] r63 - handshake.cpp

hyc subversion at mplayerhq.hu
Wed Dec 16 07:26:23 CET 2009


Author: hyc
Date: Wed Dec 16 07:26:23 2009
New Revision: 63

Log:
rtmplite hangs if we wait for it to talk first

Modified:
   handshake.cpp

Modified: handshake.cpp
==============================================================================
--- handshake.cpp	Wed Dec 16 07:24:20 2009	(r62)
+++ handshake.cpp	Wed Dec 16 07:26:23 2009	(r63)
@@ -257,12 +257,10 @@ bool CRTMP::HandShake(bool FP9HandShake)
 {
 	bool encrypted = Link.protocol == RTMP_PROTOCOL_RTMPE || Link.protocol == RTMP_PROTOCOL_RTMPTE;
 
-	FP9HandShake = true;//false;
-
-	if(encrypted && !FP9HandShake) {
-		Log(LOGERROR, "%s: RTMPE requires FP9 handshake!", __FUNCTION__);
-		return false;
-	}
+	if ( encrypted || Link.SWFHash )
+		FP9HandShake = true;
+	else
+		FP9HandShake = false;
 
 	char clientsig[RTMP_SIG_SIZE+1];
 	char serversig[RTMP_SIG_SIZE];
@@ -398,11 +396,16 @@ bool CRTMP::HandShake(bool FP9HandShake)
 	LogHex(LOGDEBUG, serversig, RTMP_SIG_SIZE);
 	#endif
 
+	if (!FP9HandShake) {
+		if(!WriteN(serversig, RTMP_SIG_SIZE))
+			return false;
+	}
+
 	// we have to use this signature now to find the correct algorithms for getting the digest and DH positions
 	int digestPosServer = GetDigestOffset2(serversig, RTMP_SIG_SIZE);
 	int dhposServer     = GetDHOffset2(serversig, RTMP_SIG_SIZE);
 
-	if(!VerifyDigest(digestPosServer, serversig, GenuineFMSKey, 36)) {
+	if(FP9HandShake && !VerifyDigest(digestPosServer, serversig, GenuineFMSKey, 36)) {
         	Log(LOGWARNING, "Trying different position for server digest!\n");
                 digestPosServer = GetDigestOffset1(serversig, RTMP_SIG_SIZE);
 		dhposServer     = GetDHOffset1(serversig, RTMP_SIG_SIZE);
@@ -493,8 +496,6 @@ bool CRTMP::HandShake(bool FP9HandShake)
 			Log(LOGWARNING, "%s: client signature does not match!", __FUNCTION__);
 		}
 
-		if(!WriteN(serversig, RTMP_SIG_SIZE))
-			return false;
 	} else {
 		// verify server response
 		int digestPosClient = GetDigestOffset1(clientsig+1, RTMP_SIG_SIZE);


More information about the rtmpdump mailing list