Skip to content

Commit 62a3fe4

Browse files
author
anahan
committed
Rename applog.DataListener to SockDataListener
1 parent 802c468 commit 62a3fe4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

cmd/docker-fpm-wrapper/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func main() {
5656

5757
if cfg.WrapperSocket != "null" {
5858
env = append(env, fmt.Sprintf("FPM_WRAPPER_SOCK=unix://%s", cfg.WrapperSocket))
59-
dataListener := applog.NewDataListener(cfg.WrapperSocket, breader.NewPool(cfg.LineBufferSize), syncStderr, errCh)
59+
dataListener := applog.NewSockDataListener(cfg.WrapperSocket, breader.NewPool(cfg.LineBufferSize), syncStderr, errCh)
6060

6161
if err = dataListener.Start(); err != nil {
6262
log.Error("Can't start listen", zap.Error(err))

internal/applog/data_listener.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/code-tool/docker-fpm-wrapper/pkg/line"
1212
)
1313

14-
type DataListener struct {
14+
type SockDataListener struct {
1515
socketPath string
1616
listener net.Listener
1717
rPool *breader.Pool
@@ -20,11 +20,11 @@ type DataListener struct {
2020
errorChan chan error
2121
}
2222

23-
func NewDataListener(socketPath string, rPool *breader.Pool, writer io.Writer, errorChan chan error) *DataListener {
24-
return &DataListener{socketPath: socketPath, rPool: rPool, writer: writer, errorChan: errorChan}
23+
func NewSockDataListener(sockPath string, rPool *breader.Pool, writer io.Writer, errorChan chan error) *SockDataListener {
24+
return &SockDataListener{socketPath: sockPath, rPool: rPool, writer: writer, errorChan: errorChan}
2525
}
2626

27-
func (l *DataListener) normalizeLine(line []byte) []byte {
27+
func (l *SockDataListener) normalizeLine(line []byte) []byte {
2828
ll := len(line)
2929
if ll > 0 && line[ll-1] != '\n' {
3030
ll += 1
@@ -39,7 +39,7 @@ func (l *DataListener) normalizeLine(line []byte) []byte {
3939
return line
4040
}
4141

42-
func (l *DataListener) handleConnection(conn net.Conn) {
42+
func (l *SockDataListener) handleConnection(conn net.Conn) {
4343
defer conn.Close()
4444

4545
reader := l.rPool.Get(conn)
@@ -63,7 +63,7 @@ func (l *DataListener) handleConnection(conn net.Conn) {
6363
}
6464
}
6565

66-
func (l *DataListener) initSocket() error {
66+
func (l *SockDataListener) initSocket() error {
6767
var err error
6868
var c net.Conn
6969

@@ -90,7 +90,7 @@ func (l *DataListener) initSocket() error {
9090
return os.Chmod(l.socketPath, 0777)
9191
}
9292

93-
func (l *DataListener) acceptConnections() {
93+
func (l *SockDataListener) acceptConnections() {
9494
for {
9595
conn, err := l.listener.Accept()
9696
if err != nil {
@@ -102,7 +102,7 @@ func (l *DataListener) acceptConnections() {
102102
}
103103
}
104104

105-
func (l *DataListener) Start() error {
105+
func (l *SockDataListener) Start() error {
106106
err := l.initSocket()
107107

108108
if err == nil {
@@ -112,6 +112,6 @@ func (l *DataListener) Start() error {
112112
return err
113113
}
114114

115-
func (l *DataListener) Stop() {
115+
func (l *SockDataListener) Stop() {
116116
_ = l.listener.Close()
117117
}

0 commit comments

Comments
 (0)