Tidy up last change to socket listener/writer
This commit is contained in:
parent
da5b46e770
commit
1486ae25c0
|
@ -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() })
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue