Skip to content

Commit e26e3e8

Browse files
committed
add isopen method
1 parent 00e5b7a commit e26e3e8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ mutable struct JSONRPCEndpoint{IOIn <: IO,IOOut <: IO}
5858
write_task::Union{Nothing,Task}
5959
end
6060

61-
JSONRPCEndpoint(pipe_in, pipe_out, err_handler=nothing) =
61+
JSONRPCEndpoint(pipe_in, pipe_out, err_handler = nothing) =
6262
JSONRPCEndpoint(pipe_in, pipe_out, Channel{Any}(Inf), Channel{Any}(Inf), Dict{String,Channel{Any}}(), err_handler, :idle, nothing, nothing)
6363

6464
function write_transport_layer(stream, response)
@@ -85,6 +85,8 @@ function read_transport_layer(stream)
8585
return message_str
8686
end
8787

88+
Base.isopen(x::JSONRPCEndpoint) = x.status != :closed && isopen(x.pipe_in) && isopen(x.pipe_out)
89+
8890
function Base.run(x::JSONRPCEndpoint)
8991
x.status == :idle || error("Endpoint is not idle.")
9092

@@ -193,7 +195,7 @@ function get_next_message(endpoint::JSONRPCEndpoint)
193195
return msg
194196
end
195197

196-
function Base.iterate(endpoint::JSONRPCEndpoint, state=nothing)
198+
function Base.iterate(endpoint::JSONRPCEndpoint, state = nothing)
197199
check_dead_endpoint!(endpoint)
198200

199201
try

0 commit comments

Comments
 (0)