连接API节点成功
(message *pb.NodeStreamMessage)
| 132 | |
| 133 | // 连接API节点成功 |
| 134 | func (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 | // 写入缓存 |
| 165 | func (this *APIStream) handleWriteCache(message *pb.NodeStreamMessage) error { |