INNER CODE UNIT · Go
func
unitedrhino/things · sdk/protocol/coreProtocol.go:139
func (p *CoreProtocol) Start() error {
ctx := ctxs.WithRoot(context.Background())
_, err := p.ProtocolM.ProtocolInfoCreate(ctx, p.Pi) //初始化协议
if err != nil && !errors.Cmp(errors.Fmt(err), errors.Duplicate) {
logx.Must(err)
}
ctx, cancel := context.WithCancel(ctxs.WithRoot(nil))
p.ctx = ctx
p.cancels = append(p.cancels, cancel)
utils.Go(ctx, func() {
run := func() {
_, err := p.ProtocolM.ProtocolServiceUpdate(ctx, &dm.ProtocolService{
Code: p.Pi.Code,
Ip: netx.InternalIp(),
Port: 0,
Status: def.True,
})
if err != nil {