summaryrefslogtreecommitdiff
path: root/src/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.go')
-rw-r--r--src/config.go27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/config.go b/src/config.go
index 2d9ac50..c889de0 100644
--- a/src/config.go
+++ b/src/config.go
@@ -9,27 +9,19 @@ import (
"strconv"
"strings"
"sync/atomic"
- "syscall"
-)
-
-const (
- ipcErrorIO = syscall.EIO
- ipcErrorNoPeer = syscall.EPROTO
- ipcErrorNoKeyValue = syscall.EPROTO
- ipcErrorInvalidKey = syscall.EPROTO
- ipcErrorInvalidValue = syscall.EPROTO
+ "time"
)
type IPCError struct {
- Code syscall.Errno
+ Code int64
}
func (s *IPCError) Error() string {
return fmt.Sprintf("IPC error: %d", s.Code)
}
-func (s *IPCError) ErrorCode() uintptr {
- return uintptr(s.Code)
+func (s *IPCError) ErrorCode() int64 {
+ return s.Code
}
func ipcGetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
@@ -58,8 +50,15 @@ func ipcGetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
if peer.endpoint != nil {
send("endpoint=" + peer.endpoint.String())
}
- send(fmt.Sprintf("tx_bytes=%d", peer.txBytes))
- send(fmt.Sprintf("rx_bytes=%d", peer.rxBytes))
+
+ nano := atomic.LoadInt64(&peer.stats.lastHandshakeNano)
+ secs := nano / time.Second.Nanoseconds()
+ nano %= time.Second.Nanoseconds()
+
+ send(fmt.Sprintf("last_handshake_time_sec=%d", secs))
+ send(fmt.Sprintf("last_handshake_time_nsec=%d", nano))
+ send(fmt.Sprintf("tx_bytes=%d", peer.stats.txBytes))
+ send(fmt.Sprintf("rx_bytes=%d", peer.stats.rxBytes))
send(fmt.Sprintf("persistent_keepalive_interval=%d",
atomic.LoadUint64(&peer.persistentKeepaliveInterval),
))