Skip to content

Conversation

@LembituNN
Copy link

…ngle server

sconn.SetInfoLogger(logger)
cconn.SetDebugLogger(log.New(os.Stdout, "DEBUG: ", logformat))
cconn.SetInfoLogger(logger)
for i := range opts.Positional.Source {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it would make more sense to iterate over the cconn array directly.

cconn.SetWarningLogger(log.New(os.Stdout, "WARN: ", logformat))
cconn.SetErrorLogger(log.New(os.Stdout, "ERROR: ", logformat))

for i := range opts.Positional.Source {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it would make more sense to iterate over the cconn array directly.

dsp := moteconnection.NewPacketDispatcher(moteconnection.NewRawPacket(byte(i)))
dsp.RegisterReceiver(creceive)
cconn.AddDispatcher(dsp)
for i := range opts.Positional.Source {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it would make more sense to iterate over the cconn array directly.

if opts.ServerServer {
logger.Printf("Listening on %s\n", ccs)
cconn.Listen()
for i := range opts.Positional.Source {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it would make more sense to iterate over the cconn array directly and skip the i's alltogether.

case p := <-sreceive:
logger.Printf("S d:%02X p:%s\n", p.Dispatch(), p)
cconn.Send(p)
for i := range opts.Positional.Source {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it would make more sense to iterate over the cconn array directly, no need for the i variable.

logger.Printf("signal %s\n", sig)
sconn.Disconnect()
cconn.Disconnect()
for i := range opts.Positional.Source {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it would make more sense to iterate over the cconn array directly, no need for the i variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants