func (r *Runner) sendGameInfos(ctx context.Context, m message.Message) {
	switch {
	case len(m.Addr) != 0:
		addrs, ok := r.playerSockets[m.PlayerName]
		if !ok {
			r.log.Printf("no player to send infos to for %v", m)
			return
		}
		socketIn, ok := addrs[m.Addr]
		if !ok {
			r.log.Printf("no socket for %v at %v", m.PlayerName, m.Addr)
			return
		}
		message.Send(m, socketIn, r.Debug, r.log)
	default:
		// send to all sockets (likely game info change)
		for _, addrs := range r.playerSockets {
			for _, socketIn := range addrs {
				message.Send(m, socketIn, r.Debug, r.log)
			}
		}
	}
}
// sendGameInfos sends the game message with infos to the single socket or all.
// When a socket is added, only it immediately needs game infos.  Otherwise, when any game info changes, all sockets must be notified.
sendGameInfos sends the game message with infos to the single socket or all.
When a socket is added, only it immediately needs game infos.  Otherwise, when any game info changes, all sockets must be notified.
// sendGameInfos sends the game message with infos to the single socket or all . // When a socket is added only it immediately needs game infos . Otherwise when any game info changes all sockets must be notified .
func (r *Runner) sendGameInfos(ctx context.Context, m message.Message) {
	switch {
	case len(m.Addr) != 0:
		addrs, ok := r.playerSockets[m.PlayerName]
		if !ok {
			r.log.Printf("no player to send infos to for %v", m)
			return
		}
		socketIn, ok := addrs[m.Addr]
		if !ok {
			r.log.Printf("no socket for %v at %v", m.PlayerName, m.Addr)
			return
		}
		message.Send(m, socketIn, r.Debug, r.log)
	default:
		for _, addrs := range r.playerSockets {
			for _, socketIn := range addrs {
				message.Send(m, socketIn, r.Debug, r.log)
			}
		}
	}
}
func ( r * Runner ) sendGameInfos ( ctx context . Context , m message . Message ) { switch { case len ( m . Addr ) != 0 : addrs , ok := r . playerSockets [ m . PlayerName ] if ! ok { r . log . Printf ( " " , m ) return } socketIn , ok := addrs [ m . Addr ] if ! ok { r . log . Printf ( " " , m . PlayerName , m . Addr ) return } message . Send ( m , socketIn , r . Debug , r . log ) default : for _ , addrs := range r . playerSockets { for _ , socketIn := range addrs { message . Send ( m , socketIn , r . Debug , r . log ) } } } }
sendGameInfos sends the game message with infos to the single socket or all.
sendGameInfos sends the game message with infos to the single socket or all .
// send to all sockets (likely game info change)