diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-05-23 17:23:50 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-05-23 17:23:50 -0400 |
commit | 8d1497a40896429191ca864a2da035fcddf286bc (patch) | |
tree | 7b1a40a605c6fc9c5770e82b1d5f592fe90f1d63 /dispatch.go | |
parent | cb222ceb227f5a7f5307085bcbebfa3cdb049598 (diff) |
Move pubMsg to dispatch
Diffstat (limited to 'dispatch.go')
-rw-r--r-- | dispatch.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/dispatch.go b/dispatch.go index 33b1fdca9..04a5eddbb 100644 --- a/dispatch.go +++ b/dispatch.go @@ -6,6 +6,10 @@ import ( "sync" ) +var resChan = make(chan *BaseMsg, 10) +var doneChan = make(chan bool) +var wg sync.WaitGroup + // There is a single global worker for this process. // This file should be the only part of deno that directly access it, so that // all interaction with V8 can go through a single point. @@ -53,9 +57,11 @@ func Pub(channel string, payload []byte) { } } -var resChan = make(chan *BaseMsg, 10) -var doneChan = make(chan bool) -var wg sync.WaitGroup +func PubMsg(channel string, msg *Msg) { + payload, err := proto.Marshal(msg) + check(err) + Pub(channel, payload) +} func DispatchLoop() { wg.Add(1) |