File tree 7 files changed +12
-13
lines changed
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 =
470
470
~params:
471
471
[
472
472
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 " )
474
474
; O. Anon (Some " call" , " Rpc.call" )
475
475
]
476
476
~ty: " response"
Original file line number Diff line number Diff line change 10
10
work in unit tests. *)
11
11
let make_client_params ~__context =
12
12
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
14
14
let session_id =
15
15
let session_id = Ref. make_secret () in
16
16
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 =
33
33
else
34
34
let response =
35
35
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
37
37
in
38
38
let translated =
39
39
if
Original file line number Diff line number Diff line change @@ -460,29 +460,28 @@ let get_http_other_config http_req =
460
460
let of_http_req ?session_id ?(internal_async_subtask = false ) ~generate_task_for
461
461
~supports_async ~label ~http_req ~fd () =
462
462
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
463
466
let new_task_context () =
464
467
let subtask_of =
465
468
Option. map Ref. of_string http_req.Http.Request. subtask_of
466
469
in
467
470
make ?session_id ?subtask_of ~http_other_config ~task_in_database: true
468
- ~origin: (Http (http_req, fd))
469
- label
471
+ ~origin label
470
472
in
471
473
if internal_async_subtask then
472
474
new_task_context ()
473
475
else
474
476
match http_req.Http.Request. task with
475
477
| 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
478
479
(Ref. of_string task_id)
479
480
| None ->
480
481
if generate_task_for && supports_async then
481
482
new_task_context ()
482
483
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
486
485
487
486
let set_test_rpc context rpc = context.test_rpc < - Some rpc
488
487
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ val of_http_req :
49
49
-> supports_async :bool
50
50
-> label :string
51
51
-> http_req :Http .Request .t
52
- -> fd :Unix .file_descr
52
+ -> fd :Unix .file_descr option
53
53
-> unit
54
54
-> t
55
55
Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ module Make : functor
3
3
(_ : Custom_actions.CUSTOM_ACTIONS )
4
4
-> sig
5
5
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
7
7
end
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ val do_dispatch :
61
61
-> string
62
62
-> (__context :Context .t -> 'a )
63
63
-> ('a -> Rpc .t )
64
- -> Unix .file_descr
64
+ -> Unix .file_descr option
65
65
-> Http.Request .t
66
66
-> string
67
67
-> [< `Async | `InternalAsync | `Sync > `Sync `InternalAsync ]
You can’t perform that action at this time.
0 commit comments