RTMP handshake fix, ReadFull now only reads upto C0C1 instead of waiting on full sequence

This commit is contained in:
Muaz Ahmad 2024-03-13 11:34:23 +05:00
parent 343146d080
commit f1a3734d95

View file

@ -18,7 +18,7 @@ func DoHandshake(conn net.Conn) (hs_success bool) {
// force handshake to finish in under 15 seconds (aribtrary) or throw an error // force handshake to finish in under 15 seconds (aribtrary) or throw an error
conn.SetDeadline(time.Now().Add(15 * time.Second)) conn.SetDeadline(time.Now().Add(15 * time.Second))
if _, err := io.ReadFull(conn, C0C1C2); err != nil || C0C1C2[0] != 3 { if _, err := io.ReadFull(conn, C0C1C2[:1+1536]); err != nil || C0C1C2[0] != 3 {
return return
} }
copy(C0C1C2[1:1536], S0S1S2[1+1536:]) copy(C0C1C2[1:1536], S0S1S2[1+1536:])