mirror of
https://github.com/slackhq/nebula.git
synced 2024-11-10 09:12:39 +08:00
chanDebug
This commit is contained in:
parent
0ccfad1a1e
commit
f2251645bb
4 changed files with 20 additions and 0 deletions
1
Makefile
1
Makefile
|
@ -206,6 +206,7 @@ ifeq ($(words $(MAKECMDGOALS)),1)
|
|||
@$(MAKE) service ${.DEFAULT_GOAL} --no-print-directory
|
||||
endif
|
||||
|
||||
bin-docker: BUILD_ARGS = -tags=mutex_debug
|
||||
bin-docker: bin build/linux-amd64/nebula build/linux-amd64/nebula-cert
|
||||
|
||||
smoke-docker: bin-docker
|
||||
|
|
|
@ -468,6 +468,7 @@ func (lh *LightHouse) QueryServer(ip iputil.VpnIp) {
|
|||
return
|
||||
}
|
||||
|
||||
chanDebugSend("lighthouse-query-chan")
|
||||
lh.queryChan <- ip
|
||||
}
|
||||
|
||||
|
@ -750,6 +751,8 @@ func (lh *LightHouse) startQueryWorker() {
|
|||
nb := make([]byte, 12, 12)
|
||||
out := make([]byte, mtu)
|
||||
|
||||
chanDebugRecv("lighthouse-query-chan")
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-lh.ctx.Done():
|
||||
|
|
|
@ -135,6 +135,19 @@ func checkMutex(state map[mutexKey]mutexValue, add mutexKey) {
|
|||
}
|
||||
}
|
||||
|
||||
func chanDebugRecv(key mutexKey) {
|
||||
m := threadLocal.Get().(map[mutexKey]mutexValue)
|
||||
checkMutex(m, key)
|
||||
v := mutexValue{}
|
||||
_, v.file, v.line, _ = runtime.Caller(1)
|
||||
m[key] = v
|
||||
}
|
||||
|
||||
func chanDebugSend(key mutexKey) {
|
||||
m := threadLocal.Get().(map[mutexKey]mutexValue)
|
||||
checkMutex(m, key)
|
||||
}
|
||||
|
||||
func (s *syncRWMutex) Lock() {
|
||||
m := threadLocal.Get().(map[mutexKey]mutexValue)
|
||||
checkMutex(m, s.mutexKey)
|
||||
|
|
|
@ -18,3 +18,6 @@ func newSyncRWMutex(mutexKey) syncRWMutex {
|
|||
func newSyncMutex(mutexKey) syncMutex {
|
||||
return sync.Mutex{}
|
||||
}
|
||||
|
||||
func chanDebugRecv(key mutexKey) {}
|
||||
func chanDebugSend(key mutexKey) {}
|
||||
|
|
Loading…
Reference in a new issue