diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2017-11-30 09:08:17 +0100 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2017-11-30 09:08:17 +0100 |
commit | acf57209ccbd67fa96644abe5aef65f58264c112 (patch) | |
tree | 59ed1cdcca28f21d4eee9451de031e41c500c710 /adapter/vppapiclient | |
parent | 67482a4f8c3a3a7cf17b4edf82e61c28b318ffd9 (diff) |
Removes unnecessary returned func from WaitReady
Change-Id: I34889c8c79fa8ef7a196f8d067edca7f1cb5ad33
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'adapter/vppapiclient')
-rw-r--r-- | adapter/vppapiclient/vppapiclient_adapter.go | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/adapter/vppapiclient/vppapiclient_adapter.go b/adapter/vppapiclient/vppapiclient_adapter.go index dfdd973..1cdaf72 100644 --- a/adapter/vppapiclient/vppapiclient_adapter.go +++ b/adapter/vppapiclient/vppapiclient_adapter.go @@ -150,33 +150,31 @@ func (a *vppAPIClientAdapter) SetMsgCallback(cb func(context uint32, msgID uint1 a.callback = cb } -// WaitReady returns func which blocks until shared memory -// for sending bin api calls is present on the file system. -func (a *vppAPIClientAdapter) WaitReady() func() error { - return func() error { - watcher, err := fsnotify.NewWatcher() - if err != nil { - return err - } - defer watcher.Close() +// WaitReady blocks until shared memory for sending +// binary api calls is present on the file system. +func (a *vppAPIClientAdapter) WaitReady() error { + watcher, err := fsnotify.NewWatcher() + if err != nil { + return err + } + defer watcher.Close() - err = watcher.Add(watchedFolder) - if err != nil { - return err - } + err = watcher.Add(watchedFolder) + if err != nil { + return err + } - if fileExists(watchedFile) { - return nil - } + if fileExists(watchedFile) { + return nil + } - for { - ev := <-watcher.Events - if ev.Name == watchedFile && (ev.Op&fsnotify.Create) == fsnotify.Create { - break - } + for { + ev := <-watcher.Events + if ev.Name == watchedFile && (ev.Op&fsnotify.Create) == fsnotify.Create { + break } - return nil } + return nil } func fileExists(name string) bool { |