renaming, cleanup

This commit is contained in:
tkarrass 2016-02-05 23:29:15 +01:00
parent 6a4fcb25c8
commit 65334c1779
8 changed files with 0 additions and 7 deletions

BIN
.gitignore vendored

Binary file not shown.

View File

@ -35,9 +35,7 @@ var clientKeys []int = make([]int, 100)
func handleConn(conn *net.TCPConn) { func handleConn(conn *net.TCPConn) {
var hs handshake var hs handshake
log.Println("Got a connection!") log.Println("Got a connection!")
// handshake // handshake
dec := gob.NewDecoder(conn) // Decoder dec := gob.NewDecoder(conn) // Decoder
dec.Decode(&hs) dec.Decode(&hs)
@ -46,13 +44,11 @@ func handleConn(conn *net.TCPConn) {
sort.Ints(clientKeys) sort.Ints(clientKeys)
clients[hs.ID] = goslClient{con: conn, id: hs.ID, w: hs.W, h: hs.H} clients[hs.ID] = goslClient{con: conn, id: hs.ID, w: hs.W, h: hs.H}
TotalWidth += hs.W TotalWidth += hs.W
// conn.Close() // conn.Close()
} }
func serveClients() { func serveClients() {
for { // while true for { // while true
for _, k := range clientKeys { for _, k := range clientKeys {
id, client := k, clients[k] id, client := k, clients[k]
if id > 0 { if id > 0 {
@ -60,13 +56,11 @@ func serveClients() {
} }
} }
time.Sleep(time.Second) time.Sleep(time.Second)
} }
} }
func runServer(cmd *cobra.Command, args []string) { func runServer(cmd *cobra.Command, args []string) {
fmt.Println("running server ...") fmt.Println("running server ...")
listener, err := net.ListenTCP("tcp", &net.TCPAddr{Port: SERVERPORT}) listener, err := net.ListenTCP("tcp", &net.TCPAddr{Port: SERVERPORT})
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
@ -82,7 +76,6 @@ func runServer(cmd *cobra.Command, args []string) {
} }
go handleConn(conn) go handleConn(conn)
} }
} }
func init() { func init() {

BIN
gosl

Binary file not shown.

View File