[p2pstore] allow topologyMatrix to be empty (#807)

when install tcp transport, nicPriorityMatrix is "". set args[0] to nil so that tcp transport can be installed
This commit is contained in:
licunlong 2025-09-09 09:48:12 +08:00 committed by GitHub
parent e711b6fcc3
commit 3554015b0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@ func (engine *TransferEngine) installTransport(protocol string, topologyMatrix s
defer C.free(unsafe.Pointer(protocolCStr))
defer C.free(unsafe.Pointer(topologyMatrixCStr))
var args [2]unsafe.Pointer
args[0] = unsafe.Pointer(topologyMatrixCStr)
if len(topologyMatrix) == 0 {
args[0] = nil
} else {
args[0] = unsafe.Pointer(topologyMatrixCStr)
}
args[1] = nil
xport := C.installTransport(engine.engine, protocolCStr, &args[0])
if xport == nil {