forked from fiorix/go-diameter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cea.go
31 lines (28 loc) · 879 Bytes
/
cea.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
// Copyright 2013-2015 go-diameter authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package sm
import (
"github.com/Omnitouch/go-diameter/v4/diam"
"github.com/Omnitouch/go-diameter/v4/diam/sm/smparser"
"github.com/Omnitouch/go-diameter/v4/diam/sm/smpeer"
)
// handleCEA handles Capabilities-Exchange-Answer messages.
func handleCEA(sm *StateMachine, errc chan error) diam.HandlerFunc {
return func(c diam.Conn, m *diam.Message) {
cea := new(smparser.CEA)
if err := cea.Parse(m, smparser.Client); err != nil {
errc <- err
return
}
meta := smpeer.FromCEA(cea)
c.SetContext(smpeer.NewContext(c.Context(), meta))
// Notify about peer passing the handshake.
select {
case sm.hsNotifyc <- c:
default:
}
// Done receiving and validating this CEA.
close(errc)
}
}