Changes to L1 router to also pass the protocol it is routing.

This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-08-03 11:55:53 -03:00
parent e0626f4176
commit 3906bd3b57
5 changed files with 69 additions and 25 deletions

View File

@@ -96,6 +96,7 @@ func (s *scheduler) Start() {
for _, session := range s.scheduledSessions {
ctx, cancel := context.WithCancel(context.Background())
session.cancel = cancel
session.ticker = time.NewTicker(1 * time.Second)
go s.cron(ctx, session)
}
s.event.On(event.SESSION_NEW, func(sessionId string, args ...interface{}) {
@@ -128,7 +129,6 @@ func (s *scheduler) register(session *types.Session) *scheduledSession {
}
func (s *scheduler) cron(ctx context.Context, session *scheduledSession) {
session.ticker = time.NewTicker(1 * time.Second)
for {
select {
case <-session.ticker.C:
@@ -167,6 +167,7 @@ func (s *scheduler) Schedule(session *types.Session) error {
scheduledSession := s.register(session)
ctx, cancel := context.WithCancel(context.Background())
scheduledSession.cancel = cancel
scheduledSession.ticker = time.NewTicker(1 * time.Second)
go s.cron(ctx, scheduledSession)
return nil
}