MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / handleConnectedAPINode

Method handleConnectedAPINode

internal/nodes/api_stream.go:134–162  ·  view source on GitHub ↗

连接API节点成功

(message *pb.NodeStreamMessage)

Source from the content-addressed store, hash-verified

132
133// 连接API节点成功
134func (this *APIStream) handleConnectedAPINode(message *pb.NodeStreamMessage) error {
135 // 更改连接的APINode信息
136 if len(message.DataJSON) == 0 {
137 return nil
138 }
139 msg := &messageconfigs.ConnectedAPINodeMessage{}
140 err := json.Unmarshal(message.DataJSON, msg)
141 if err != nil {
142 return errors.Wrap(err)
143 }
144
145 _, err = rpc.SharedRPC()
146 if err != nil {
147 return errors.Wrap(err)
148 }
149
150 remotelogs.Println("API_STREAM", "connected to api node '"+strconv.FormatInt(msg.APINodeId, 10)+"'")
151
152 // 重新读取配置
153 if nodeConfigUpdatedAt == 0 {
154 select {
155 case nodeConfigChangedNotify <- true:
156 default:
157
158 }
159 }
160
161 return nil
162}
163
164// 写入缓存
165func (this *APIStream) handleWriteCache(message *pb.NodeStreamMessage) error {

Callers 1

loopMethod · 0.95

Calls 3

WrapFunction · 0.92
SharedRPCFunction · 0.92
PrintlnFunction · 0.92

Tested by

no test coverage detected