summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2017-04-23 17:28:28 +0200
committerChristian Pointner <equinox@spreadspace.org>2017-04-23 17:28:28 +0200
commit58d925ecbc3b2f246e8c1e77e05b03962aed824b (patch)
treed7817582e9c8126c8f2091b61bb2de292f5dffd3 /src
parentminor web interface fix (diff)
no warning on expected error on client disconnect
Diffstat (limited to 'src')
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvPipe.go9
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5store.go6
2 files changed, 13 insertions, 2 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvPipe.go b/src/hub/src/spreadspace.org/sfive/s5srvPipe.go
index 8084461..efc190c 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvPipe.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvPipe.go
@@ -2,6 +2,7 @@ package sfive
import (
"bufio"
+ "io"
"net"
)
@@ -9,7 +10,9 @@ func (self StatsSinkServer) handleConnection(conn net.Conn) {
reader := bufio.NewReader(conn)
buffer, err := reader.ReadBytes('\n')
if err != nil {
- s5l.Printf("pipe: failed to read from connection: %v\n", err)
+ if err != io.EOF {
+ s5l.Printf("pipe: failed to read from connection: %v\n", err)
+ }
return
}
marshaller, err := NewStatefulDecoder(buffer)
@@ -21,7 +24,9 @@ func (self StatsSinkServer) handleConnection(conn net.Conn) {
for {
buffer, err := reader.ReadBytes('\n')
if err != nil {
- s5l.Printf("pipe: failed to read from connection: %v\n", err)
+ if err != io.EOF {
+ s5l.Printf("pipe: failed to read from connection: %v\n", err)
+ }
return
}
diff --git a/src/hub/src/spreadspace.org/sfive/s5store.go b/src/hub/src/spreadspace.org/sfive/s5store.go
index cd95076..bbfce00 100644
--- a/src/hub/src/spreadspace.org/sfive/s5store.go
+++ b/src/hub/src/spreadspace.org/sfive/s5store.go
@@ -285,6 +285,9 @@ func itob(v int) []byte {
}
func (s sqliteStore) insertDataUpdateClientEntries(cd []ClientData, du dataUpdateDb) error {
+ if len(cd) == 0 {
+ return nil
+ }
return s.dbBolt.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(clientDataBn))
jsonData, err := json.Marshal(cd)
@@ -401,6 +404,9 @@ func (s sqliteStore) GetClientsByUpdateId(id int) (res []ClientData, err error)
b := tx.Bucket([]byte(clientDataBn))
jsonData := b.Get(itob(id))
+ if jsonData == nil {
+ return nil
+ }
return json.Unmarshal(jsonData, &res)
})
return