Description
The parser's Parser()
function runs in a goroutine as shown below:
gobmp/pkg/gobmpsrv/gobmpsrv.go
Lines 79 to 80 in 9fbd0c3
And messages read from the client are sent to the parser via the parserQueue channel:
gobmp/pkg/gobmpsrv/gobmpsrv.go
Line 115 in 9fbd0c3
And for every message received, the parser does its work in a goroutine:
Lines 10 to 14 in 9fbd0c3
At the end of its work the parser sends the parsed BMP message to the producer via the producerQueue:
Lines 105 to 107 in 9fbd0c3
So it seems possible that 2 back-to-back messages from a client device would be handled in parallel because of go parsingWorker(msg, producerQueue)
in the Parser()
function. And theoretically add/del messages could get handled in an incorrect order by the producer. Unless I've misunderstood this part of the code :-)
It seems overkill to have multiple goroutines to process messages from the same client. I'd make a synchronous call to parsingWorker() instead. But I don't have the history...
Update: I just clued in that it's to handle the stop
msg/chan. But I think it's an issue as mentioned above. Use WaitGroup?