Tidy up last change to socket listener/writer

This commit is contained in:
Daniel Nelson 2018-04-17 17:48:30 -07:00
parent 37474d28a5
commit fc74c1afa5
2 changed files with 3 additions and 13 deletions

View File

@ -13,6 +13,7 @@ import (
"time"
"crypto/tls"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/inputs"
@ -338,14 +339,6 @@ func (uc unixCloser) Close() error {
return err
}
func (uc unixCloser) Accept() (net.Conn, error) {
return uc.closer.(net.Listener).Accept()
}
func (uc unixCloser) Addr() net.Addr {
return uc.closer.(net.Listener).Addr()
}
func init() {
inputs.Add("socket_listener", func() telegraf.Input { return newSocketListener() })
}

View File

@ -7,6 +7,7 @@ import (
"strings"
"crypto/tls"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/outputs"
@ -70,11 +71,6 @@ func (sw *SocketWriter) SetSerializer(s serializers.Serializer) {
}
func (sw *SocketWriter) Connect() error {
var (
c net.Conn
err error
)
spl := strings.SplitN(sw.Address, "://", 2)
if len(spl) != 2 {
return fmt.Errorf("invalid address: %s", sw.Address)
@ -85,6 +81,7 @@ func (sw *SocketWriter) Connect() error {
return err
}
var c net.Conn
if tlsCfg == nil {
c, err = net.Dial(spl[0], spl[1])
} else {