util.go 538 B

1234567891011121314151617181920212223242526272829
  1. package util
  2. var msgHandler map[string](chan interface{})
  3. func GetMsgHandler(msgPipe string) chan interface{} {
  4. hdr, has := msgHandler[msgPipe]
  5. if !has {
  6. hdr = make(chan interface{})
  7. msgHandler[msgPipe] = hdr
  8. }
  9. return hdr
  10. }
  11. func PostMessage(msgPipe string, msg interface{}) {
  12. hdr, has := msgHandler[msgPipe]
  13. if !has {
  14. hdr = make(chan interface{})
  15. msgHandler[msgPipe] = hdr
  16. }
  17. hdr <- msg
  18. }
  19. func init() {
  20. msgHandler = make(map[string]chan interface{})
  21. }
  22. func DebugLevel() int {
  23. return 1
  24. }