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