Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddMsgHandler matches parts of addresses #44

Open
CDaxi opened this issue Jul 25, 2020 · 0 comments
Open

AddMsgHandler matches parts of addresses #44

CDaxi opened this issue Jul 25, 2020 · 0 comments

Comments

@CDaxi
Copy link

CDaxi commented Jul 25, 2020

Example code:

  addr := "127.0.0.1:9000"
  d := osc.NewStandardDispatcher()

  d.AddMsgHandler("/time/str", func (msg *osc.Message) {
      fmt.Print("-> ")
      fmt.Println(msg)
  })

Example console output:

-> /time ,f 16743.264
-> /time/str ,s 4:39:03.263
-> /time ,f 16743.36
-> /time/str ,s 4:39:03.359

The code should only match /time/str but the MsgHandler matches /time without str too.
This code lines seems to be the reason:
https://github.com/hypebeast/go-osc/blob/master/osc/osc.go#L146
https://github.com/hypebeast/go-osc/blob/master/osc/osc.go#L212

Escaping the address with \/ does not help.
If I do this, I will get an error unknown escape sequence

Current workaround:

  • Implement a catch all MsgHandler ("*")
  • Do the address check manually without Regex

I would be very happy to have this issue fixed because this creates very confusing issues.

Thanks a lot.
Christian

@CDaxi CDaxi changed the title AddMsgHandler does not support wildcards but matches parts of addresses AddMsgHandler matches parts of addresses Jul 25, 2020
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

No branches or pull requests

1 participant