Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RExec.connect: handle protocol version negotiation #57

Merged
merged 2 commits into from
Nov 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/rExec.ml
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ let with_flow ~ty ~domid ~port fn =
recv_hello client >>= function
| version when version < 2l -> fail (error "Unsupported qrexec version %ld" version)
| version ->
if version > 2l
then Log.debug (fun f -> f "Other end wants to use newer protocol %lu, \
continuing with version 2" version);
Log.info (fun f -> f "client connected, \
other end wants to use protocol version %lu, \
continuing with version 2" version);
send_hello client >|= fun () ->
Flow.create ~ty client
)
Expand Down Expand Up @@ -376,6 +376,10 @@ let connect ~domid () =
QV.server ~domid ~port:vchan_base_port () >>= fun t ->
let t = { t; clients = Hashtbl.create 4; counter = 0; } in
send_hello t.t >>= fun () ->
recv_hello t.t >>= fun version ->
Log.info (fun f -> f "client connected, using protocol version %ld" version);
return t
recv_hello t.t >>= function
| version when version < 2l -> fail (error "Unsupported qrexec version %ld" version)
| version ->
Log.info (fun f -> f "client connected, \
other end wants to use protocol version %lu, \
continuing with version 2" version);
return t