MCPcopy
hub / github.com/tinode/chat / proxyCtrlBroadcast

Method proxyCtrlBroadcast

server/topic_proxy.go:269–285  ·  view source on GitHub ↗

proxyCtrlBroadcast broadcasts a ctrl command to certain sessions attached to this proxy topic.

(msg *ServerComMessage)

Source from the content-addressed store, hash-verified

267
268// proxyCtrlBroadcast broadcasts a ctrl command to certain sessions attached to this proxy topic.
269func (t *Topic) proxyCtrlBroadcast(msg *ServerComMessage) {
270 if msg.Ctrl.Code == http.StatusResetContent && msg.Ctrl.Text == "evicted" {
271 // We received a ctrl command for evicting a user.
272 if msg.uid.IsZero() {
273 logs.Err.Panicf("proxy topic[%s]: proxy received evict message with empty uid", t.name)
274 }
275 for sess := range t.sessions {
276 // Proxy topic may only have ordinary sessions. No multiplexing or proxy sessions here.
277 if _, removed := t.remSession(sess, msg.uid); removed {
278 sess.detachSession(t.name)
279 if sess.sid != msg.SkipSid {
280 sess.queueOut(msg)
281 }
282 }
283 }
284 }
285}
286
287// updateAcsFromPresMsg modifies user acs in Topic's perUser struct based on the data in `pres`.
288func (t *Topic) updateAcsFromPresMsg(pres *MsgServerPres) {

Callers 1

proxyMasterResponseMethod · 0.95

Calls 4

remSessionMethod · 0.95
detachSessionMethod · 0.80
queueOutMethod · 0.80
IsZeroMethod · 0.45

Tested by

no test coverage detected