Force read peer chunk size message from client
This commit is contained in:
parent
5df64adcbd
commit
c7ea01e3bd
2 changed files with 15 additions and 0 deletions
|
@ -2,6 +2,7 @@ package rtmp
|
|||
|
||||
import (
|
||||
"net"
|
||||
"encoding/binary"
|
||||
)
|
||||
|
||||
type ChunkWrapper struct {
|
||||
|
@ -45,3 +46,12 @@ func (chnk_wrp_ptr *ChunkWrapper) ReadChunk() (*Message, error) {
|
|||
}
|
||||
return full_msg_ptr, nil
|
||||
}
|
||||
|
||||
func (chnk_wrp_ptr *ChunkWrapper) ReadPeerChunkSize() (error) {
|
||||
set_chunk_size_msg, err := chnk_wrp_ptr.ReadChunk()
|
||||
if err != nil || set_chunk_size_msg.msg_type != 1 || set_chunk_size_msg.msg_len != 4 {
|
||||
return err
|
||||
}
|
||||
chnk_wrp_ptr.params.peer_chunk_size = binary.BigEndian.Uint32(set_chunk_size_msg.data)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -5,6 +5,11 @@ import (
|
|||
)
|
||||
|
||||
func NegotiateConnect(chnk_wrp_ptr *ChunkWrapper) (bool) {
|
||||
fmt.Println(chnk_wrp_ptr.params.peer_chunk_size)
|
||||
if err := chnk_wrp_ptr.ReadPeerChunkSize(); err != nil {
|
||||
return false
|
||||
}
|
||||
fmt.Println(chnk_wrp_ptr.params.peer_chunk_size)
|
||||
for {
|
||||
full_msg_ptr, err := chnk_wrp_ptr.ReadChunk()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue