From e070a85ae0454f24bfae477de78b82ffb915647b Mon Sep 17 00:00:00 2001 From: James Shubin Date: Wed, 22 Feb 2017 16:45:36 -0500 Subject: [PATCH] lib: Misc cleanups and new log message --- lib/main.go | 4 ++-- resources/sendrecv.go | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/main.go b/lib/main.go index 4ffa017d..d6cdbab5 100644 --- a/lib/main.go +++ b/lib/main.go @@ -398,8 +398,7 @@ func (obj *Main) Run() error { } if err != nil { obj.Exit(err) // trigger exit - continue - //return // TODO: return or wait for exitchan? + continue // wait for exitchan } if obj.NoWatch { // extra safety for bad GAPI's log.Printf("Main: GAPI stream should be quiet with NoWatch!") // fix the GAPI! @@ -454,6 +453,7 @@ func (obj *Main) Run() error { // FIXME: make sure we "UnGroup()" any semi-destructive // changes to the resources so our efficient GraphSync // will be able to re-use and cmp to the old graph. + log.Printf("Main: GraphSync...") newFullGraph, err := newGraph.GraphSync(oldGraph) if err != nil { log.Printf("Config: Error running graph sync: %v", err) diff --git a/resources/sendrecv.go b/resources/sendrecv.go index 96f51639..c7dfdc39 100644 --- a/resources/sendrecv.go +++ b/resources/sendrecv.go @@ -41,6 +41,13 @@ func (obj *BaseRes) Event() error { // SendEvent pushes an event into the message queue for a particular vertex. func (obj *BaseRes) SendEvent(ev event.EventName, err error) error { + if obj.debug { + if err == nil { + log.Printf("%s[%s]: SendEvent(%+v)", obj.Kind(), obj.GetName(), ev) + } else { + log.Printf("%s[%s]: SendEvent(%+v): %v", obj.Kind(), obj.GetName(), ev, err) + } + } resp := event.NewResp() obj.mutex.Lock() if !obj.working {