-
Notifications
You must be signed in to change notification settings - Fork 86
/
client_control_not_connected_handler.go
61 lines (51 loc) · 1.37 KB
/
client_control_not_connected_handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// Copyright (c) 2018- yutopp ([email protected])
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
//
package rtmp
import (
"github.com/yutopp/go-rtmp/internal"
"github.com/yutopp/go-rtmp/message"
)
var _ stateHandler = (*clientControlNotConnectedHandler)(nil)
// clientControlNotConnectedHandler Handle control messages from a server in flow of connecting.
//
// transitions:
// | "_result" -> controlStreamStateConnected
// | _ -> self
type clientControlNotConnectedHandler struct {
sh *streamHandler
}
func (h *clientControlNotConnectedHandler) onMessage(
chunkStreamID int,
timestamp uint32,
msg message.Message,
) error {
return internal.ErrPassThroughMsg
}
func (h *clientControlNotConnectedHandler) onData(
chunkStreamID int,
timestamp uint32,
dataMsg *message.DataMessage,
body interface{},
) error {
return internal.ErrPassThroughMsg
}
func (h *clientControlNotConnectedHandler) onCommand(
chunkStreamID int,
timestamp uint32,
cmdMsg *message.CommandMessage,
body interface{},
) error {
l := h.sh.Logger()
switch cmd := body.(type) {
case *message.NetConnectionConnectResult:
l.Info("ConnectResult")
l.Infof("Result: Info = %+v, Props = %+v", cmd.Information, cmd.Properties)
return nil
default:
return internal.ErrPassThroughMsg
}
}