This commit is contained in:
crusader 2018-04-13 20:22:50 +09:00
parent 423ec815a2
commit 9f2ff9438c

View File

@ -127,6 +127,7 @@ func (s *ProbeServlets) OnDisconnect(servletCtx server.ServletCtx) {
}
func (s *ProbeServlets) handleSubscribe(serverCtx server.ServerCtx, subscribeChan <-chan *ogs.Message) {
var sessions []*ogrs.Session
LOOP:
for {
@ -138,19 +139,24 @@ LOOP:
switch msg.TargetType {
case ogs.PROBE:
sessions := s.getProbeSessions(msg.Targets)
if nil == sessions || 0 == len(sessions) {
continue LOOP
}
sessions = s.getProbeSessions(msg.Targets)
default:
logging.Logger().Warnf("Subscriber: Unknown TargetType %s", msg.TargetType)
continue LOOP
}
for _, session := range sessions {
_writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey)
if nil != _writeChan {
writeChan := _writeChan.(chan<- []byte)
writeChan <- *msg.Message
}
if nil == sessions || 0 == len(sessions) {
continue LOOP
}
for _, session := range sessions {
_writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey)
if nil != _writeChan {
writeChan := _writeChan.(chan<- []byte)
writeChan <- *msg.Message
}
}
}
}
}