Skip to content

Commit 7a31179

Browse files
authored
Merge pull request #167 from bhaan/session-msg-handling
Handle OnLogon/Logout callbacks in user space
2 parents e5a1ce7 + 8c1afce commit 7a31179

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

session.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ func (s *session) accept(msgIn chan fixIn, msgOut chan []byte, quit chan bool) {
150150
}
151151

152152
func (s *session) onDisconnect() {
153-
s.application.OnLogout(s.sessionID)
154153
s.log.OnEvent("Disconnected")
154+
go s.application.OnLogout(s.sessionID)
155155
}
156156

157157
func (s *session) insertSendingTime(header Header) {
@@ -295,8 +295,6 @@ func (s *session) handleLogon(msg Message) error {
295295
s.log.OnEvent("Received logon response")
296296
}
297297

298-
s.application.OnLogon(s.sessionID)
299-
300298
if err := s.checkTargetTooHigh(msg); err != nil {
301299
switch TypedError := err.(type) {
302300
case targetTooHigh:
@@ -306,6 +304,7 @@ func (s *session) handleLogon(msg Message) error {
306304
}
307305

308306
s.store.IncrNextTargetMsgSeqNum()
307+
go s.application.OnLogon(s.sessionID)
309308
return nil
310309
}
311310

0 commit comments

Comments
 (0)