Refactor, remove unused buffer and stream map init

This commit is contained in:
Muaz Ahmad 2023-08-10 23:51:24 +05:00
parent c7ea01e3bd
commit 48c3bb1df4

View file

@ -31,25 +31,6 @@ type ChunkBuffers struct {
csid_true []byte csid_true []byte
} }
func new_chunk_bufs() (*ChunkBuffers) {
new_chunk_bufs := ChunkBuffers{
make([]byte, 4),
make([]byte, 4),
make([]byte, 1),
make([]byte, 4),
make([]byte, 1),
make([]byte, 2),
}
return &new_chunk_bufs
}
func OpenStreamsMapInit() (map[uint32]*ChunkStream, map[uint32]*Message, *ChunkBuffers) {
open_chnkstrms := make(map[uint32]*ChunkStream)
open_msgs := make(map[uint32]*Message)
chunk_bufs_ptr := new_chunk_bufs()
return open_chnkstrms, open_msgs, chunk_bufs_ptr
}
func read_basic_header(conn net.Conn, chunk_bufs_ptr *ChunkBuffers) (format uint8, csid uint32, err error) { func read_basic_header(conn net.Conn, chunk_bufs_ptr *ChunkBuffers) (format uint8, csid uint32, err error) {
if _, err = conn.Read(chunk_bufs_ptr.fmt_csid_byte); err != nil { if _, err = conn.Read(chunk_bufs_ptr.fmt_csid_byte); err != nil {
return return