Add terminal messages upon session closing

This commit is contained in:
Qian Wang 2019-07-25 20:57:02 +01:00
parent 0695f9df13
commit 8f9922b06b
3 changed files with 2 additions and 1 deletions

View File

@ -173,6 +173,7 @@ func (sesh *Session) timeoutAfter(to time.Duration) {
sesh.streamsM.Lock() sesh.streamsM.Lock()
if len(sesh.streams) == 0 && !sesh.IsBroken() { if len(sesh.streams) == 0 && !sesh.IsBroken() {
sesh.streamsM.Unlock() sesh.streamsM.Unlock()
sesh.SetTerminalMsg("timeout")
sesh.Close() sesh.Close()
} else { } else {
sesh.streamsM.Unlock() sesh.streamsM.Unlock()

View File

@ -105,6 +105,7 @@ func (sb *switchboard) removeConn(closing *connEnclave) {
} }
} }
if len(sb.ces) == 0 { if len(sb.ces) == 0 {
sb.session.SetTerminalMsg("no underlying connection left")
sb.session.Close() sb.session.Close()
} }
sb.cesM.Unlock() sb.cesM.Unlock()

View File

@ -48,7 +48,6 @@ func (u *ActiveUser) GetSession(sessionID uint32, obfs mux.Obfser, deobfs mux.De
} }
} }
// TODO: allow message to pass through this and sesh.Close()
func (u *ActiveUser) Terminate(reason string) { func (u *ActiveUser) Terminate(reason string) {
u.sessionsM.Lock() u.sessionsM.Lock()
for _, sesh := range u.sessions { for _, sesh := range u.sessions {