move mutex calls to outer function
--HG-- branch : nmdc-ircfrontend
This commit is contained in:
parent
7bf832322d
commit
74e4f6cfa3
11
server.go
11
server.go
@ -445,6 +445,10 @@ func (s *Server) handleRegisteredCommand(command string, args []string) {
|
||||
// response first. Once we get that, it'll connect instantly
|
||||
go func() {
|
||||
<-time.After(WAIT_FOR_VERSION * time.Second)
|
||||
|
||||
s.ClientStateLock.Lock()
|
||||
defer s.ClientStateLock.Unlock()
|
||||
|
||||
s.maybeStartUpstream()
|
||||
}()
|
||||
|
||||
@ -464,9 +468,6 @@ func (s *Server) handleRegisteredCommand(command string, args []string) {
|
||||
}
|
||||
|
||||
func (s *Server) maybeStartUpstream() {
|
||||
s.ClientStateLock.Lock()
|
||||
defer s.ClientStateLock.Unlock()
|
||||
|
||||
if s.clientState != CSJoined {
|
||||
// Join for the first time
|
||||
s.clientState = CSJoined
|
||||
@ -513,6 +514,9 @@ func (s *Server) SetClientSoftwareVersion(ver string) {
|
||||
s.upstreamLauncher.Self.ClientVersion = version
|
||||
s.recievedCtcpVersion = true
|
||||
|
||||
s.ClientStateLock.Lock()
|
||||
defer s.ClientStateLock.Unlock()
|
||||
|
||||
if s.upstream != nil {
|
||||
s.upstream.Hco.Self.ClientTag = tag
|
||||
s.upstream.Hco.Self.ClientVersion = version
|
||||
@ -520,6 +524,7 @@ func (s *Server) SetClientSoftwareVersion(ver string) {
|
||||
|
||||
} else {
|
||||
// Connected for the first time (order was CTCP VERSION --> JOIN)
|
||||
|
||||
s.maybeStartUpstream()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user