summaryrefslogtreecommitdiffstats
path: root/core/network.go
blob: c182e7fd0d80749afc53697f0242481e45c4da78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package core

import (
	"fmt"
	"net"
)

func ReadConnection(conn net.Conn) {
	for {
		payload, err := Decode(conn)
		if err != nil {
			panic(err)
		}

		if err := handle(payload); err != nil {
			panic(err)
		}
	}
}

func handle(payload any) error {
	fmt.Println(payload)
	return nil
}