func (r *Runner) addSocket(ctx context.Context, wg *sync.WaitGroup, sm message.Socket, socketOut chan<- message.Message, lobbyIn chan<- message.Message) {
	s, err := r.handleAddSocket(ctx, wg, sm, socketOut)
	sm.Result <- err // signal that the socket is added
	if err != nil {
		return
	}
	// request game infos for the only the new socket
	// make the request asynchronously because lobby might be processing other messages by now
	m := message.Message{
		Type:       message.GameInfos,
		PlayerName: sm.PlayerName,
		Addr:       s.Addr,
	}
	go message.Send(m, lobbyIn, r.Debug, r.log)
}
// handleAddSocket adds a socket and sends a response if on the result channel of the request.
handleAddSocket adds a socket and sends a response if on the result channel of the request.
// handleAddSocket adds a socket and sends a response if on the result channel of the request .
func (r *Runner) addSocket(ctx context.Context, wg *sync.WaitGroup, sm message.Socket, socketOut chan<- message.Message, lobbyIn chan<- message.Message) {
	s, err := r.handleAddSocket(ctx, wg, sm, socketOut)
	sm.Result <- err 
	if err != nil {
		return
	}
	m := message.Message{
		Type:       message.GameInfos,
		PlayerName: sm.PlayerName,
		Addr:       s.Addr,
	}
	go message.Send(m, lobbyIn, r.Debug, r.log)
}
func ( r * Runner ) addSocket ( ctx context . Context , wg * sync . WaitGroup , sm message . Socket , socketOut chan <- message . Message , lobbyIn chan <- message . Message ) { s , err := r . handleAddSocket ( ctx , wg , sm , socketOut ) sm . Result <- err if err != nil { return } m := message . Message { Type : message . GameInfos , PlayerName : sm . PlayerName , Addr : s . Addr , } go message . Send ( m , lobbyIn , r . Debug , r . log ) }
handleAddSocket adds a socket and sends a response if on the result channel of the request.
handleAddSocket adds a socket and sends a response if on the result channel of the request .
// signal that the socket is added // request game infos for the only the new socket // make the request asynchronously because lobby might be processing other messages by now