fiorix / go-smpp

SMPP 3.4 Protocol for the Go programming language
MIT License
220 stars 134 forks source link

Initialize random source in Transceiver. #8

Closed AlekSi closed 8 years ago

AlekSi commented 8 years ago

Aside: The code in Bind() methods seems to be a copy&paste. I don't really understand why there is Addr, User, etc. in Transceiver and embedded Transmitter with the same fields. That's something I would refactor in my code. But maybe I don't understand it all.

fiorix commented 8 years ago

That's because the Transmitter part of the Transceiver is the same, but the Receiver part of the Transceiver is not - it has to share the same inflight to multiplex i/o messages.

Instead of initializing the random source on both, you could do a lazy initialization only in the Transmitter's Bind by using sync.Once.

fiorix commented 8 years ago

Haven't had time to review this yet. Any input from others is appreciated.