mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
persist lastSignoff in the database
This commit is contained in:
parent
17a89838b8
commit
4472683d58
3 changed files with 66 additions and 9 deletions
|
|
@ -94,6 +94,12 @@ func (client *Client) AllSessionData(currentSession *Session) (data []SessionDat
|
|||
}
|
||||
|
||||
func (client *Client) AddSession(session *Session) (success bool, numSessions int, lastSignoff time.Time) {
|
||||
defer func() {
|
||||
if !lastSignoff.IsZero() {
|
||||
client.wakeWriter()
|
||||
}
|
||||
}()
|
||||
|
||||
client.stateMutex.Lock()
|
||||
defer client.stateMutex.Unlock()
|
||||
|
||||
|
|
@ -111,6 +117,7 @@ func (client *Client) AddSession(session *Session) (success bool, numSessions in
|
|||
// on the server with no sessions:
|
||||
lastSignoff = client.lastSignoff
|
||||
client.lastSignoff = time.Time{}
|
||||
client.dirtyBits |= IncludeLastSignoff
|
||||
}
|
||||
client.sessions = newSessions
|
||||
return true, len(client.sessions), lastSignoff
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue