MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / close

Method close

internal/nodehub/hub.go:377–388  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

375}
376
377func (c *conn) close() {
378 c.closeOnce.Do(func() {
379 close(c.closed)
380 })
381 // 关闭所有未结束的流订阅,避免 caller 永久阻塞。
382 // 放在 closeOnce 之外是为了允许 close() 多次调用都执行(虽然实际通常只一次)。
383 c.streamSubs.Range(func(key, value any) bool {
384 s := value.(*Stream)
385 s.closeFromHub(ErrNodeOffline)
386 return true
387 })
388}
389
390// IsOnline 返回指定 nodeID 是否当前在线。
391func (h *Hub) IsOnline(nodeID string) bool {

Callers 5

SessionMethod · 0.95
reapOnceMethod · 0.80
DisconnectMethod · 0.80
connectFunction · 0.80
StatPageFunction · 0.80

Calls 1

closeFromHubMethod · 0.80

Tested by

no test coverage detected