@@ -16,7 +16,7 @@ import (
16
16
"sync"
17
17
"time"
18
18
19
- zmq "github.com/go-zeromq/zmq4"
19
+ "github.com/go-zeromq/zmq4"
20
20
"golang.org/x/xerrors"
21
21
22
22
"github.com/cosmos72/gomacro/ast2"
@@ -48,7 +48,7 @@ type ConnectionInfo struct {
48
48
49
49
// Socket wraps a zmq socket with a lock which should be used to control write access.
50
50
type Socket struct {
51
- Socket zmq .Socket
51
+ Socket zmq4 .Socket
52
52
Lock * sync.Mutex
53
53
}
54
54
@@ -102,7 +102,7 @@ const (
102
102
)
103
103
104
104
// RunWithSocket invokes the `run` function after acquiring the `Socket.Lock` and releases the lock when done.
105
- func (s * Socket ) RunWithSocket (run func (socket zmq .Socket ) error ) error {
105
+ func (s * Socket ) RunWithSocket (run func (socket zmq4 .Socket ) error ) error {
106
106
s .Lock .Lock ()
107
107
defer s .Lock .Unlock ()
108
108
return run (s .Socket )
@@ -164,7 +164,7 @@ func runKernel(connectionFile string) {
164
164
// TODO gracefully shutdown the heartbeat handler on kernel shutdown by closing the chan returned by startHeartbeat.
165
165
166
166
type msgType struct {
167
- Msg zmq .Msg
167
+ Msg zmq4 .Msg
168
168
Err error
169
169
}
170
170
@@ -176,7 +176,7 @@ func runKernel(connectionFile string) {
176
176
)
177
177
178
178
defer close (quit )
179
- poll := func (msgs chan msgType , sck zmq .Socket ) {
179
+ poll := func (msgs chan msgType , sck zmq4 .Socket ) {
180
180
defer close (msgs )
181
181
for {
182
182
msg , err := sck .Recv ()
@@ -250,27 +250,27 @@ func prepareSockets(connInfo ConnectionInfo) (SocketGroup, error) {
250
250
251
251
// Create the shell socket, a request-reply socket that may receive messages from multiple frontend for
252
252
// code execution, introspection, auto-completion, etc.
253
- sg .ShellSocket .Socket = zmq .NewRouter (ctx )
253
+ sg .ShellSocket .Socket = zmq4 .NewRouter (ctx )
254
254
sg .ShellSocket .Lock = & sync.Mutex {}
255
255
256
256
// Create the control socket. This socket is a duplicate of the shell socket where messages on this channel
257
257
// should jump ahead of queued messages on the shell socket.
258
- sg .ControlSocket .Socket = zmq .NewRouter (ctx )
258
+ sg .ControlSocket .Socket = zmq4 .NewRouter (ctx )
259
259
sg .ControlSocket .Lock = & sync.Mutex {}
260
260
261
261
// Create the stdin socket, a request-reply socket used to request user input from a front-end. This is analogous
262
262
// to a standard input stream.
263
- sg .StdinSocket .Socket = zmq .NewRouter (ctx )
263
+ sg .StdinSocket .Socket = zmq4 .NewRouter (ctx )
264
264
sg .StdinSocket .Lock = & sync.Mutex {}
265
265
266
266
// Create the iopub socket, a publisher for broadcasting data like stdout/stderr output, displaying execution
267
267
// results or errors, kernel status, etc. to connected subscribers.
268
- sg .IOPubSocket .Socket = zmq .NewPub (ctx )
268
+ sg .IOPubSocket .Socket = zmq4 .NewPub (ctx )
269
269
sg .IOPubSocket .Lock = & sync.Mutex {}
270
270
271
271
// Create the heartbeat socket, a request-reply socket that only allows alternating recv-send (request-reply)
272
272
// calls. It should echo the byte strings it receives to let the requester know the kernel is still alive.
273
- sg .HBSocket .Socket = zmq .NewRep (ctx )
273
+ sg .HBSocket .Socket = zmq4 .NewRep (ctx )
274
274
sg .HBSocket .Lock = & sync.Mutex {}
275
275
276
276
// Bind the sockets.
@@ -575,7 +575,7 @@ func startHeartbeat(hbSocket Socket, wg *sync.WaitGroup) (shutdown chan struct{}
575
575
defer wg .Done ()
576
576
577
577
type msgType struct {
578
- Msg zmq .Msg
578
+ Msg zmq4 .Msg
579
579
Err error
580
580
}
581
581
@@ -604,7 +604,7 @@ func startHeartbeat(hbSocket Socket, wg *sync.WaitGroup) (shutdown chan struct{}
604
604
case <- timeout .C :
605
605
continue
606
606
case v := <- msgs :
607
- hbSocket .RunWithSocket (func (echo zmq .Socket ) error {
607
+ hbSocket .RunWithSocket (func (echo zmq4 .Socket ) error {
608
608
if v .Err != nil {
609
609
log .Fatalf ("Error reading heartbeat ping bytes: %v\n " , v .Err )
610
610
return v .Err
0 commit comments