Pooler data race fix and experimental qt5 interface.

Fixed Pooler's data race which occurs on every server's pinging
goroutine creation, because of uncontrolled write to current
requests counter. Protected it with mutex.

Added very experimental and not-yet-working qt5 interface. Maybe
it will be completed someday.
This commit is contained in:
2016-12-13 04:47:17 +05:00
parent af26eff895
commit 384754276a
6 changed files with 576 additions and 0 deletions

View File

@@ -29,6 +29,8 @@ type Pooler struct {
maxrequests int
// Packet prefix.
pp string
// Current requests counter mutex.
cur_requests_mutex sync.Mutex
}
func (p *Pooler) Initialize() {
@@ -73,11 +75,15 @@ func (p *Pooler) PingServers(servers_type string) {
}
}
wait.Add(1)
p.cur_requests_mutex.Lock()
cur_requests += 1
p.cur_requests_mutex.Unlock()
go func(srv *datamodels.Server) {
defer wait.Done()
p.pingServersExecutor(srv)
p.cur_requests_mutex.Lock()
cur_requests -= 1
p.cur_requests_mutex.Unlock()
}(server_to_ping.Server)
}
wait.Wait()