This commit is contained in:
crusader 2018-04-13 20:23:55 +09:00
parent 9f2ff9438c
commit cd50707b16

View File

@ -150,6 +150,8 @@ func (s *AuthServlets) OnDisconnect(servletCtx server.ServletCtx) {
} }
func (s *AuthServlets) handleSubscribe(serverCtx server.ServerCtx, subscribeChan <-chan *ogs.Message) { func (s *AuthServlets) handleSubscribe(serverCtx server.ServerCtx, subscribeChan <-chan *ogs.Message) {
var sessions []*ogrs.Session
LOOP: LOOP:
for { for {
select { select {
@ -160,17 +162,20 @@ LOOP:
switch msg.TargetType { switch msg.TargetType {
case ogs.PROBE: case ogs.PROBE:
sessions := s.getAuthSessions(msg.Targets) sessions = s.getAuthSessions(msg.Targets)
if nil == sessions || 0 == len(sessions) { default:
continue LOOP logging.Logger().Warnf("Subscriber: Unknown TargetType %s", msg.TargetType)
} continue LOOP
}
if nil == sessions || 0 == len(sessions) {
continue LOOP
}
for _, session := range sessions { for _, session := range sessions {
_writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey) _writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey)
if nil != _writeChan { if nil != _writeChan {
writeChan := _writeChan.(chan<- []byte) writeChan := _writeChan.(chan<- []byte)
writeChan <- *msg.Message writeChan <- *msg.Message
}
} }
} }
} }