Skip to content

Commit

Permalink
Add initial timeout, trim message, better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bsideup committed Jan 15, 2018
1 parent 1ba5889 commit 52e34c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"
"net"
"net/url"
"strings"
"time"

"github.com/docker/docker/api/types"
Expand Down Expand Up @@ -40,6 +41,8 @@ func main() {
for {
message, err := reader.ReadString('\n')

message = strings.TrimSpace(message)

if len(message) > 0 {
query, err := url.ParseQuery(message)

Expand All @@ -61,7 +64,7 @@ func main() {
continue
}

log.Printf("%+v\n", param)
log.Printf("Adding %s\n", param)

deathNote[param] = true

Expand All @@ -81,6 +84,8 @@ func main() {
TimeoutLoop:
for {
select {
case <-time.After(1 * time.Minute):
panic("Timed out waiting for the initial connection")
case <-connected:
log.Println("Connected")
case <-disconnected:
Expand Down

0 comments on commit 52e34c4

Please sign in to comment.