mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +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" ```
33 lines
535 B
Go
33 lines
535 B
Go
package netlink
|
|
|
|
import (
|
|
"encoding/binary"
|
|
|
|
"github.com/vishvananda/netlink/nl"
|
|
)
|
|
|
|
var (
|
|
native = nl.NativeEndian()
|
|
networkOrder = binary.BigEndian
|
|
)
|
|
|
|
func htonl(val uint32) []byte {
|
|
bytes := make([]byte, 4)
|
|
binary.BigEndian.PutUint32(bytes, val)
|
|
return bytes
|
|
}
|
|
|
|
func htons(val uint16) []byte {
|
|
bytes := make([]byte, 2)
|
|
binary.BigEndian.PutUint16(bytes, val)
|
|
return bytes
|
|
}
|
|
|
|
func ntohl(buf []byte) uint32 {
|
|
return binary.BigEndian.Uint32(buf)
|
|
}
|
|
|
|
func ntohs(buf []byte) uint16 {
|
|
return binary.BigEndian.Uint16(buf)
|
|
}
|