server: add error to OnSessionClose()

This commit is contained in:
aler9
2021-05-04 15:51:35 +02:00
committed by Alessandro Ros
parent 6f749e6ba8
commit 9d42a63102
9 changed files with 99 additions and 79 deletions

View File

@@ -19,7 +19,7 @@ type testServerHandler struct {
onConnOpen func(*ServerConn)
onConnClose func(*ServerConn, error)
onSessionOpen func(*ServerSession)
onSessionClose func(*ServerSession)
onSessionClose func(*ServerSession, error)
onDescribe func(*ServerHandlerOnDescribeCtx) (*base.Response, []byte, error)
onAnnounce func(*ServerHandlerOnAnnounceCtx) (*base.Response, error)
onSetup func(*ServerHandlerOnSetupCtx) (*base.Response, error)
@@ -49,9 +49,9 @@ func (sh *testServerHandler) OnSessionOpen(ss *ServerSession) {
}
}
func (sh *testServerHandler) OnSessionClose(ss *ServerSession) {
func (sh *testServerHandler) OnSessionClose(ss *ServerSession, err error) {
if sh.onSessionClose != nil {
sh.onSessionClose(ss)
sh.onSessionClose(ss, err)
}
}
@@ -211,7 +211,7 @@ func TestServerHighLevelPublishRead(t *testing.T) {
s := &Server{
Handler: &testServerHandler{
onSessionClose: func(ss *ServerSession) {
onSessionClose: func(ss *ServerSession, err error) {
mutex.Lock()
defer mutex.Unlock()