Skip to content

Commit

Permalink
Tidy up last change to socket listener/writer
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson committed Apr 18, 2018
1 parent da5b46e commit 1486ae2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
9 changes: 1 addition & 8 deletions plugins/inputs/socket_listener/socket_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"time"

"crypto/tls"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/inputs"
Expand Down Expand Up @@ -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 changes: 2 additions & 5 deletions plugins/outputs/socket_writer/socket_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"

"crypto/tls"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/outputs"
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit 1486ae2

Please sign in to comment.