MCPcopy
hub / github.com/baetyl/baetyl / connect

Method connect

engine/msg_handler.go:159–185  ·  view source on GitHub ↗
(key string, m *v1.Message)

Source from the content-addressed store, hash-verified

157}
158
159func (h *handlerDownside) connect(key string, m *v1.Message) error {
160 // close old chain if exist
161 old, ok := h.chains.Load(key)
162 if ok {
163 err := old.(chain.Chain).Close()
164 if err != nil {
165 h.log.Warn("failed to close old chain", log.Any("chain", key))
166 }
167 h.chains.Delete(key)
168 h.log.Debug("close chain", log.Any("chain name", key))
169 }
170 h.log.Debug("new chain", log.Any("chain name", key))
171
172 // create new chain
173 c, err := chain.NewChain(h.cfg, h.ami, m.Metadata)
174 if err != nil {
175 h.publishFailedMsg(key, ErrCreateChain, m)
176 return errors.Trace(err)
177 }
178 err = c.Debug()
179 if err != nil {
180 h.publishFailedMsg(key, ErrExecData, m)
181 return errors.Trace(err)
182 }
183 h.chains.Store(key, c)
184 return nil
185}
186
187func (h *handlerDownside) sendExit(key string) {
188 m := &v1.Message{

Callers 1

OnMessageMethod · 0.95

Calls 4

DebugMethod · 0.95
publishFailedMsgMethod · 0.95
NewChainFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected