mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
depend on io.WriteCloser instead of net.Conn
This commit is contained in:
parent
8d8f1e72eb
commit
78caad2dbd
@ -2,6 +2,7 @@ package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"sync"
|
||||
)
|
||||
@ -56,13 +57,13 @@ func StopServer() {
|
||||
}
|
||||
}
|
||||
|
||||
func handler(conn net.Conn) {
|
||||
func handler(wc io.WriteCloser) {
|
||||
server.wg.Add(1)
|
||||
defer server.wg.Done()
|
||||
defer conn.Close()
|
||||
defer wc.Close()
|
||||
for msg := range Log.tail() {
|
||||
msg = fmt.Sprintf("%s\n", msg)
|
||||
conn.Write([]byte(msg))
|
||||
wc.Write([]byte(msg))
|
||||
}
|
||||
conn.Write([]byte("bye\n"))
|
||||
wc.Write([]byte("bye\n"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user