Using my readN - tested and working

This commit is contained in:
saxon 2018-07-28 15:50:59 +09:30
parent 89e5f334da
commit 670e79f8f0
1 changed files with 6 additions and 6 deletions

View File

@ -762,9 +762,8 @@ func handShake(r *C.RTMP, FP9HandShake int32) int {
return 0 return 0
} }
// TODO: port this //if C.ReadN(r, (*C.char)(unsafe.Pointer(&typ)), 1) != 1 {
if C.ReadN(r, (*C.char)(unsafe.Pointer(&typ)), 1) != 1 { if readN(r, (*byte)(unsafe.Pointer(&typ)), 1) != 1 {
// if readN(r, (*byte)(unsafe.Pointer(&typ)), 1) != 1 {
return 0 return 0
} }
@ -775,8 +774,8 @@ func handShake(r *C.RTMP, FP9HandShake int32) int {
log.Println("handShake: type mismatch: client sent %v, server sent: %v", log.Println("handShake: type mismatch: client sent %v, server sent: %v",
clientbuf[0], typ) clientbuf[0], typ)
} }
if readN(r, (*byte)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
if C.ReadN(r, (*C.char)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE { //if C.ReadN(r, (*C.char)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
return 0 return 0
} }
@ -789,7 +788,8 @@ func handShake(r *C.RTMP, FP9HandShake int32) int {
return 0 return 0
} }
if C.ReadN(r, (*C.char)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE { if readN(r, (*byte)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
// if C.ReadN(r, (*C.char)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
return 0 return 0
} }