Store and init protocol parameters

This commit is contained in:
Muaz Ahmad 2023-08-10 15:29:10 +05:00
parent 05087ccbb3
commit 510be80449

View file

@ -4,6 +4,13 @@ import (
"net" "net"
) )
type ProtocolParams struct {
peer_chunk_size uint32
chunk_size uint32
peer_ack_win uint32
curr_read uint32
}
func NewServer(port *string) (error) { func NewServer(port *string) (error) {
l, err := net.Listen("tcp", ":" + *port) l, err := net.Listen("tcp", ":" + *port)
if err != nil { if err != nil {
@ -33,7 +40,9 @@ func handle_conn(conn net.Conn, stream_live *bool) {
if !DoHandshake(conn) { if !DoHandshake(conn) {
return return
} }
if !NegotiateConnect(conn) { params := ProtocolParams{1024, 512, 0, 0}
open_chnkstrms, open_msgs, chunk_buffers := OpenStreamsMapInit()
if !NegotiateConnect(conn, &params, open_chnkstrms, open_msgs, chunk_buffers) {
return return
} }