diff options
Diffstat (limited to 'src/go/plugin/go.d/pkg')
-rw-r--r-- | src/go/plugin/go.d/pkg/socket/client.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/go/plugin/go.d/pkg/socket/client.go b/src/go/plugin/go.d/pkg/socket/client.go index 26ae1dfa..c2bcbd9e 100644 --- a/src/go/plugin/go.d/pkg/socket/client.go +++ b/src/go/plugin/go.d/pkg/socket/client.go @@ -21,6 +21,15 @@ func New(config Config) *Socket { } } +func ConnectAndRead(config Config, process Processor) error { + s := New(config) + if err := s.Connect(); err != nil { + return err + } + defer func() { _ = s.Disconnect() }() + return read(s.conn, process, s.ReadTimeout) +} + // Socket is the implementation of a socket client. type Socket struct { Config |