mirror of
https://github.com/status-im/status-go.git
synced 2025-01-15 09:19:26 +00:00
b2580c79d7
Network disconnect is introduced by removing default gateway, easily reversible condition. On my local machine it takes 30 seconds for peers to reconnect after connectivity is restored. As you guess this is not an accident, and there is 30 seconds timeout for dial expiration. This dial expiration is used in p2p.Server to guarantee that peers are not dialed too often. Additionally I added small script to Makefile to run such tests in docker environment, usage example: ``` make docker-test ARGS="./t/destructive/ -v -network=4" ```
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
package netlink
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// Protinfo represents bridge flags from netlink.
|
|
type Protinfo struct {
|
|
Hairpin bool
|
|
Guard bool
|
|
FastLeave bool
|
|
RootBlock bool
|
|
Learning bool
|
|
Flood bool
|
|
ProxyArp bool
|
|
ProxyArpWiFi bool
|
|
}
|
|
|
|
// String returns a list of enabled flags
|
|
func (prot *Protinfo) String() string {
|
|
var boolStrings []string
|
|
if prot.Hairpin {
|
|
boolStrings = append(boolStrings, "Hairpin")
|
|
}
|
|
if prot.Guard {
|
|
boolStrings = append(boolStrings, "Guard")
|
|
}
|
|
if prot.FastLeave {
|
|
boolStrings = append(boolStrings, "FastLeave")
|
|
}
|
|
if prot.RootBlock {
|
|
boolStrings = append(boolStrings, "RootBlock")
|
|
}
|
|
if prot.Learning {
|
|
boolStrings = append(boolStrings, "Learning")
|
|
}
|
|
if prot.Flood {
|
|
boolStrings = append(boolStrings, "Flood")
|
|
}
|
|
if prot.ProxyArp {
|
|
boolStrings = append(boolStrings, "ProxyArp")
|
|
}
|
|
if prot.ProxyArpWiFi {
|
|
boolStrings = append(boolStrings, "ProxyArpWiFi")
|
|
}
|
|
return strings.Join(boolStrings, " ")
|
|
}
|
|
|
|
func boolToByte(x bool) []byte {
|
|
if x {
|
|
return []byte{1}
|
|
}
|
|
return []byte{0}
|
|
}
|
|
|
|
func byteToBool(x byte) bool {
|
|
return uint8(x) != 0
|
|
}
|