Skip to content

Commit 525b62c

Browse files
committed
Adds log to readLoop
1 parent fbe0cd7 commit 525b62c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

acceptor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func (a *Acceptor) handleConnection(netConn net.Conn) {
356356

357357
go func() {
358358
msgIn <- fixIn{msgBytes, parser.lastRead}
359-
readLoop(parser, msgIn)
359+
readLoop(parser, msgIn, a.globalLog)
360360
}()
361361

362362
writeLoop(netConn, msgOut, a.globalLog)

connection.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ func writeLoop(connection io.Writer, messageOut chan []byte, log Log) {
3030
}
3131
}
3232

33-
func readLoop(parser *parser, msgIn chan fixIn) {
33+
func readLoop(parser *parser, msgIn chan fixIn, log Log) {
3434
defer close(msgIn)
3535

3636
for {
3737
msg, err := parser.ReadMessage()
3838
if err != nil {
39+
log.OnEvent(err.Error())
3940
return
4041
}
4142
msgIn <- fixIn{msg, parser.lastRead}

initiator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (i *Initiator) handleConnection(session *session, tlsConfig *tls.Config, di
198198
goto reconnect
199199
}
200200

201-
go readLoop(newParser(bufio.NewReader(netConn)), msgIn)
201+
go readLoop(newParser(bufio.NewReader(netConn)), msgIn, session.log)
202202
disconnected = make(chan interface{})
203203
go func() {
204204
writeLoop(netConn, msgOut, session.log)

0 commit comments

Comments
 (0)