correct writer
This commit is contained in:
16
TCPClient.go
16
TCPClient.go
@@ -188,7 +188,7 @@ func (c *TCPClient) ReadLine() {
|
||||
if strings.Contains(messageString, "Hello") || strings.Contains(messageString, "Welcome") {
|
||||
go c.SetFilters()
|
||||
if Cfg.Cluster.Command != "" {
|
||||
c.WriteString(Cfg.Cluster.Command + "\n\r")
|
||||
c.Write([]byte(Cfg.Cluster.Command + "\n\r"))
|
||||
Log.Debugf("Sending Command: %s", Cfg.Cluster.Command)
|
||||
}
|
||||
}
|
||||
@@ -213,18 +213,10 @@ func (c *TCPClient) ReadLine() {
|
||||
// Write sends raw data to remove telnet server
|
||||
func (tc *TCPClient) Write(data []byte) (n int, err error) {
|
||||
n, err = tc.Writer.Write(data)
|
||||
if err == nil {
|
||||
if err != nil {
|
||||
Log.Errorf("Error while sending command to telnet client: %s", err)
|
||||
} else {
|
||||
err = tc.Writer.Flush()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (tc *TCPClient) WriteString(data string) (n int, err error) {
|
||||
n, err = tc.Writer.Write([]byte(data))
|
||||
if err == nil {
|
||||
err = tc.Writer.Flush()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user