beautify.

This commit is contained in:
Miroslav Šedivý 2020-12-02 17:23:35 +01:00
parent 82d37b15e4
commit 220e162f42

View File

@ -97,6 +97,7 @@ func (manager *SessionManagerCtx) Delete(id string) error {
// --- // ---
// host // host
// --- // ---
func (manager *SessionManagerCtx) HasHost() bool { func (manager *SessionManagerCtx) HasHost() bool {
manager.hostMu.Lock() manager.hostMu.Lock()
defer manager.hostMu.Unlock() defer manager.hostMu.Unlock()
@ -131,6 +132,7 @@ func (manager *SessionManagerCtx) ClearHost() {
// --- // ---
// members list // members list
// --- // ---
func (manager *SessionManagerCtx) HasConnectedMembers() bool { func (manager *SessionManagerCtx) HasConnectedMembers() bool {
manager.membersMu.Lock() manager.membersMu.Lock()
defer manager.membersMu.Unlock() defer manager.membersMu.Unlock()
@ -201,6 +203,7 @@ func (manager *SessionManagerCtx) AdminBroadcast(v interface{}, exclude interfac
// --- // ---
// events // events
// --- // ---
func (manager *SessionManagerCtx) OnHost(listener func(session types.Session)) { func (manager *SessionManagerCtx) OnHost(listener func(session types.Session)) {
manager.emmiter.On("host", func(payload ...interface{}) { manager.emmiter.On("host", func(payload ...interface{}) {
listener(payload[0].(*SessionCtx)) listener(payload[0].(*SessionCtx))
@ -235,6 +238,10 @@ func (manager *SessionManagerCtx) OnDisconnected(listener func(session types.Ses
}) })
} }
// ---
// config
// ---
func (manager *SessionManagerCtx) ImplicitHosting() bool { func (manager *SessionManagerCtx) ImplicitHosting() bool {
return manager.config.ImplicitHosting return manager.config.ImplicitHosting
} }