(rooms *Rooms, current ClientInfo)
| 16 | type ClientAnswer outgoing.P2PMessage |
| 17 | |
| 18 | func (e *ClientAnswer) Execute(rooms *Rooms, current ClientInfo) error { |
| 19 | room, err := rooms.CurrentRoom(current) |
| 20 | if err != nil { |
| 21 | return err |
| 22 | } |
| 23 | |
| 24 | session, ok := room.Sessions[e.SID] |
| 25 | |
| 26 | if !ok { |
| 27 | log.Debug().Str("id", e.SID.String()).Msg("unknown session") |
| 28 | return nil |
| 29 | } |
| 30 | |
| 31 | if session.Client != current.ID { |
| 32 | return fmt.Errorf("permission denied for session %s", e.SID) |
| 33 | } |
| 34 | |
| 35 | room.Users[session.Host].WriteTimeout(outgoing.ClientAnswer(*e)) |
| 36 | |
| 37 | return nil |
| 38 | } |
nothing calls this directly
no test coverage detected