diff --git a/REQUIRE b/REQUIRE index 9f5f639b..c99c2b85 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,7 +1,7 @@ julia 0.7 MbedTLS 0.4.3 JSON 0.17 -ZMQ 0.6.0 +ZMQ 1.0.0 Compat 0.69.0 Conda 0.1.5 SoftGlobalScope diff --git a/src/heartbeat.jl b/src/heartbeat.jl index 08838cc6..ab1dc3a9 100644 --- a/src/heartbeat.jl +++ b/src/heartbeat.jl @@ -18,5 +18,5 @@ end function start_heartbeat(sock) heartbeat_c = @cfunction(heartbeat_thread, Cvoid, (Ptr{Cvoid},)) ccall(:uv_thread_create, Cint, (Ptr{Int}, Ptr{Cvoid}, Ptr{Cvoid}), - threadid, heartbeat_c, sock.data) + threadid, heartbeat_c, sock) end diff --git a/src/init.jl b/src/init.jl index f9316d02..8f3c61c4 100644 --- a/src/init.jl +++ b/src/init.jl @@ -21,7 +21,6 @@ function __init__() end # the following constants need to be initialized in init(). -const ctx = Ref{Context}() const publish = Ref{Socket}() const raw_input = Ref{Socket}() const requests = Ref{Socket}() @@ -91,12 +90,11 @@ function init(args) profile["key"]) end - ctx[] = Context() - publish[] = Socket(ctx[], PUB) - raw_input[] = Socket(ctx[], ROUTER) - requests[] = Socket(ctx[], ROUTER) - control[] = Socket(ctx[], ROUTER) - heartbeat[] = Socket(ctx[], ROUTER) + publish[] = Socket(PUB) + raw_input[] = Socket(ROUTER) + requests[] = Socket(ROUTER) + control[] = Socket(ROUTER) + heartbeat[] = Socket(ROUTER) bind(publish[], "$(profile["transport"])://$(profile["ip"]):$(profile["iopub_port"])") bind(requests[], "$(profile["transport"])://$(profile["ip"]):$(profile["shell_port"])") bind(control[], "$(profile["transport"])://$(profile["ip"]):$(profile["control_port"])") diff --git a/src/msg.jl b/src/msg.jl index 61f07650..6208d2ee 100644 --- a/src/msg.jl +++ b/src/msg.jl @@ -45,17 +45,17 @@ function send_ipython(socket, m::Msg) try @vprintln("SENDING ", m) for i in m.idents - send(socket, i, SNDMORE) + send(socket, i, more=true) end - send(socket, "", SNDMORE) + send(socket, "", more=true) header = json(m.header) parent_header = json(m.parent_header) metadata = json(m.metadata) content = json(m.content) - send(socket, hmac(header, parent_header, metadata, content), SNDMORE) - send(socket, header, SNDMORE) - send(socket, parent_header, SNDMORE) - send(socket, metadata, SNDMORE) + send(socket, hmac(header, parent_header, metadata, content), more=true) + send(socket, header, more=true) + send(socket, parent_header, more=true) + send(socket, metadata, more=true) send(socket, content) finally unlock(socket_locks[socket]) @@ -65,22 +65,20 @@ end function recv_ipython(socket) lock(socket_locks[socket]) try - msg = recv(socket) idents = String[] - s = unsafe_string(msg) + s = recv(socket, String) @vprintln("got msg part $s") while s != "" push!(idents, s) - msg = recv(socket) - s = unsafe_string(msg) + s = recv(socket, String) @vprintln("got msg part $s") end - signature = unsafe_string(recv(socket)) + signature = recv(socket, String) request = Dict{String,Any}() - header = unsafe_string(recv(socket)) - parent_header = unsafe_string(recv(socket)) - metadata = unsafe_string(recv(socket)) - content = unsafe_string(recv(socket)) + header = recv(socket, String) + parent_header = recv(socket, String) + metadata = recv(socket, String) + content = recv(socket, String) if signature != hmac(header, parent_header, metadata, content) error("Invalid HMAC signature") # What should we do here? end