chunk format 3 handling

This commit is contained in:
Muaz Ahmad 2023-08-10 13:24:06 +05:00
parent 37e28d88d3
commit 48029e0ee6

View file

@ -212,8 +212,6 @@ func read_message_header_2(conn net.Conn, chnk_stream_ptr *chnk_stream, msg_ptr
return nil return nil
} }
func read_chunk_data(conn net.Conn, msg_ptr *message, chnk_size uint32) (error) { func read_chunk_data(conn net.Conn, msg_ptr *message, chnk_size uint32) (error) {
bytes_left := msg_ptr.msg_len - msg_ptr.curr_bytes_read bytes_left := msg_ptr.msg_len - msg_ptr.curr_bytes_read
var buffer_end uint32 var buffer_end uint32
@ -265,6 +263,9 @@ func ReadChunk(conn net.Conn, open_chnkstrms map[uint32]*chnk_stream, open_msgs
if err := read_message_header_2(conn, chnkstream_ptr, msg_ptr, chunk_bufs_ptr); err != nil { if err := read_message_header_2(conn, chnkstream_ptr, msg_ptr, chunk_bufs_ptr); err != nil {
return nil, err return nil, err
} }
case 3:
chnkstream_ptr = open_chnkstrms[csid]
msg_ptr = open_msgs[chnkstream_ptr.last_msg_strm_id]
} }
@ -272,6 +273,8 @@ func ReadChunk(conn net.Conn, open_chnkstrms map[uint32]*chnk_stream, open_msgs
return nil, err return nil, err
} }
conn.SetDeadline(time.Time{})
if msg_ptr.curr_bytes_read < msg_ptr.msg_len { if msg_ptr.curr_bytes_read < msg_ptr.msg_len {
open_msgs[chnkstream_ptr.last_msg_strm_id] = msg_ptr open_msgs[chnkstream_ptr.last_msg_strm_id] = msg_ptr
return nil, nil return nil, nil
@ -279,7 +282,4 @@ func ReadChunk(conn net.Conn, open_chnkstrms map[uint32]*chnk_stream, open_msgs
delete(open_msgs, chnkstream_ptr.last_msg_strm_id) delete(open_msgs, chnkstream_ptr.last_msg_strm_id)
return msg_ptr, nil return msg_ptr, nil
} }
conn.SetDeadline(time.Time{})
return nil, nil
} }