Commit 0c4ce822 authored by ceddral's avatar ceddral
Browse files

player: reconnect: do not kill windowSizeLoop

windowSizeLoop does not access any variables that are altered during a
reconnect. therefore it can continue to run uninterrupted
parent 38f7110a
......@@ -89,7 +89,7 @@ func main() {
}
gs.players["ceddral"].connClosed<-struct{}{}
go fakeInputLoop(gs.players["ceddral"].inputKill)
go fakeWindowSizeLoop(gs.players["ceddral"].windowSizeLoopKill)
go gs.players["ceddral"].windowSizeLoop()
gs.players["since"] = &Player{
conn: &FakeConn{},
connClosed: make(chan struct{}, 1),
......@@ -103,7 +103,7 @@ func main() {
}
gs.players["since"].connClosed<-struct{}{}
go fakeInputLoop(gs.players["since"].inputKill)
go fakeWindowSizeLoop(gs.players["since"].windowSizeLoopKill)
go gs.players["since"].windowSizeLoop()
NewGame([]string{"since", "ceddral"}, []string{"base", "ext1"})
if err != nil {
......
......@@ -66,8 +66,6 @@ func NewPlayer(conn net.Conn) (p *Player) {
// kill old player components to be replaced
pOld.inputKill <- struct{}{}
pOld.windowSizeLoopKill <- struct{}{} // trigger loop termination
pOld.windowSizeLoopKill <- struct{}{} // await loop termination
pOld.conn.Close()
// clean up new player input, was only needed to query username
......@@ -89,7 +87,6 @@ func NewPlayer(conn net.Conn) (p *Player) {
// new players need to be sent to the meta lobby context
panic("TODO Connect for new players not implemented yet")
}
go p.windowSizeLoop()
err = p.scr.Redraw()
if err != nil {
log.Println(err)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment