Skip to content

Commit

Permalink
Change 更改afterBindCallbacks调用位置
Browse files Browse the repository at this point in the history
  • Loading branch information
urionz authored and felipejfc committed Sep 14, 2023
1 parent 08e4aaa commit a0e49e6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,6 @@ func (s *sessionImpl) Bind(ctx context.Context, uid string) error {
}
}

for _, cb := range s.pool.afterBindCallbacks {
err := cb(ctx, s)
if err != nil {
s.uid = ""
return err
}
}

// if code running on frontend server
if s.IsFrontend {
// If a session with the same UID already exists in this frontend server, close it
Expand All @@ -456,6 +448,17 @@ func (s *sessionImpl) Bind(ctx context.Context, uid string) error {
return err
}
}


// invoke after callbacks on session bound
for _, cb := range s.pool.afterBindCallbacks {
err := cb(ctx, s)
if err != nil {
s.uid = ""
return err
}
}

return nil
}

Expand Down

0 comments on commit a0e49e6

Please sign in to comment.