mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-14 16:17:17 +03:00
moving Lock() call
This commit is contained in:
parent
99c2cf1756
commit
a160bc9bac
@ -222,12 +222,12 @@ func (s *Server) proposeName(name string) (string, error) {
|
||||
|
||||
// Rename renames the given client (user)
|
||||
func (s *Server) Rename(client *Client, newName string) {
|
||||
s.Lock()
|
||||
var oldName string
|
||||
if strings.ToLower(newName) == strings.ToLower(client.Name) {
|
||||
oldName = client.Name
|
||||
client.Rename(newName)
|
||||
} else {
|
||||
s.Lock()
|
||||
newName, err := s.proposeName(newName)
|
||||
if err != nil {
|
||||
client.SysMsg("%s", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user