File tree Expand file tree Collapse file tree 7 files changed +12
-13
lines changed Expand file tree Collapse file tree 7 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ let gen_module api : O.Module.t =
470470 ~params:
471471 [
472472 O. Anon (Some " http_req" , " Http.Request.t" )
473- ; O. Anon (Some " fd" , " Unix.file_descr" )
473+ ; O. Anon (Some " fd" , " Unix.file_descr option " )
474474 ; O. Anon (Some " call" , " Rpc.call" )
475475 ]
476476 ~ty: " response"
Original file line number Diff line number Diff line change 1010 work in unit tests. *)
1111let make_client_params ~__context =
1212 let req = Xmlrpc_client. xmlrpc ~version: " 1.1" " /" in
13- let rpc = Api_server.Server. dispatch_call req Unix. stdout in
13+ let rpc = Api_server.Server. dispatch_call req None in
1414 let session_id =
1515 let session_id = Ref. make_secret () in
1616 let now = Xapi_stdext_date.Date. now () in
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ let callback1 ?(json_rpc_version = Jsonrpc.V1) is_json req fd call =
3333 else
3434 let response =
3535 let @ req = Helper. with_tracing ~name: " Server.dispatch_call" req in
36- Server. dispatch_call req fd call
36+ Server. dispatch_call req ( Some fd) call
3737 in
3838 let translated =
3939 if
Original file line number Diff line number Diff line change @@ -460,29 +460,28 @@ let get_http_other_config http_req =
460460let of_http_req ?session_id ?(internal_async_subtask = false ) ~generate_task_for
461461 ~supports_async ~label ~http_req ~fd () =
462462 let http_other_config = get_http_other_config http_req in
463+ let origin =
464+ match fd with None -> Internal | Some fd -> Http (http_req, fd)
465+ in
463466 let new_task_context () =
464467 let subtask_of =
465468 Option. map Ref. of_string http_req.Http.Request. subtask_of
466469 in
467470 make ?session_id ?subtask_of ~http_other_config ~task_in_database: true
468- ~origin: (Http (http_req, fd))
469- label
471+ ~origin label
470472 in
471473 if internal_async_subtask then
472474 new_task_context ()
473475 else
474476 match http_req.Http.Request. task with
475477 | Some task_id ->
476- from_forwarded_task ?session_id ~http_other_config
477- ~origin: (Http (http_req, fd))
478+ from_forwarded_task ?session_id ~http_other_config ~origin
478479 (Ref. of_string task_id)
479480 | None ->
480481 if generate_task_for && supports_async then
481482 new_task_context ()
482483 else
483- make ?session_id ~http_other_config
484- ~origin: (Http (http_req, fd))
485- label
484+ make ?session_id ~http_other_config ~origin label
486485
487486let set_test_rpc context rpc = context.test_rpc < - Some rpc
488487
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ val of_http_req :
4949 -> supports_async :bool
5050 -> label :string
5151 -> http_req :Http .Request .t
52- -> fd :Unix .file_descr
52+ -> fd :Unix .file_descr option
5353 -> unit
5454 -> t
5555
Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ module Make : functor
33 (_ : Custom_actions.CUSTOM_ACTIONS )
44 -> sig
55 val dispatch_call :
6- Http.Request .t -> Unix .file_descr -> Rpc .call -> Rpc .response
6+ Http.Request .t -> Unix .file_descr option -> Rpc .call -> Rpc .response
77end
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ val do_dispatch :
6161 -> string
6262 -> (__context :Context .t -> 'a )
6363 -> ('a -> Rpc .t )
64- -> Unix .file_descr
64+ -> Unix .file_descr option
6565 -> Http.Request .t
6666 -> string
6767 -> [< `Async | `InternalAsync | `Sync > `Sync `InternalAsync ]
You can’t perform that action at this time.
0 commit comments