mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-11 05:43:57 +01:00
chanDebug
This commit is contained in:
parent
0ccfad1a1e
commit
f2251645bb
1
Makefile
1
Makefile
@ -206,6 +206,7 @@ ifeq ($(words $(MAKECMDGOALS)),1)
|
|||||||
@$(MAKE) service ${.DEFAULT_GOAL} --no-print-directory
|
@$(MAKE) service ${.DEFAULT_GOAL} --no-print-directory
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
bin-docker: BUILD_ARGS = -tags=mutex_debug
|
||||||
bin-docker: bin build/linux-amd64/nebula build/linux-amd64/nebula-cert
|
bin-docker: bin build/linux-amd64/nebula build/linux-amd64/nebula-cert
|
||||||
|
|
||||||
smoke-docker: bin-docker
|
smoke-docker: bin-docker
|
||||||
|
|||||||
@ -468,6 +468,7 @@ func (lh *LightHouse) QueryServer(ip iputil.VpnIp) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chanDebugSend("lighthouse-query-chan")
|
||||||
lh.queryChan <- ip
|
lh.queryChan <- ip
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,6 +751,8 @@ func (lh *LightHouse) startQueryWorker() {
|
|||||||
nb := make([]byte, 12, 12)
|
nb := make([]byte, 12, 12)
|
||||||
out := make([]byte, mtu)
|
out := make([]byte, mtu)
|
||||||
|
|
||||||
|
chanDebugRecv("lighthouse-query-chan")
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-lh.ctx.Done():
|
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() {
|
func (s *syncRWMutex) Lock() {
|
||||||
m := threadLocal.Get().(map[mutexKey]mutexValue)
|
m := threadLocal.Get().(map[mutexKey]mutexValue)
|
||||||
checkMutex(m, s.mutexKey)
|
checkMutex(m, s.mutexKey)
|
||||||
|
|||||||
@ -18,3 +18,6 @@ func newSyncRWMutex(mutexKey) syncRWMutex {
|
|||||||
func newSyncMutex(mutexKey) syncMutex {
|
func newSyncMutex(mutexKey) syncMutex {
|
||||||
return sync.Mutex{}
|
return sync.Mutex{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func chanDebugRecv(key mutexKey) {}
|
||||||
|
func chanDebugSend(key mutexKey) {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user