@@ -554,6 +554,22 @@ impl Dispatcher {
554
554
}
555
555
}
556
556
}
557
+
558
+ fn on_foreign_function ( & self , context_id : u32 , function_id : u32 , arugments_size : usize ) {
559
+ if let Some ( http_stream) = self . http_streams . borrow_mut ( ) . get_mut ( & context_id) {
560
+ self . active_id . set ( context_id) ;
561
+ hostcalls:: set_effective_context ( context_id) . unwrap ( ) ;
562
+ http_stream. on_foreign_function ( function_id, arugments_size)
563
+ } else if let Some ( stream) = self . streams . borrow_mut ( ) . get_mut ( & context_id) {
564
+ self . active_id . set ( context_id) ;
565
+ hostcalls:: set_effective_context ( context_id) . unwrap ( ) ;
566
+ stream. on_foreign_function ( function_id, arugments_size)
567
+ } else if let Some ( root) = self . roots . borrow_mut ( ) . get_mut ( & context_id) {
568
+ self . active_id . set ( context_id) ;
569
+ hostcalls:: set_effective_context ( context_id) . unwrap ( ) ;
570
+ root. on_foreign_function ( function_id, arugments_size)
571
+ }
572
+ }
557
573
}
558
574
559
575
#[ no_mangle]
@@ -722,3 +738,13 @@ pub extern "C" fn proxy_on_grpc_receive_trailing_metadata(
722
738
pub extern "C" fn proxy_on_grpc_close ( _context_id : u32 , token_id : u32 , status_code : u32 ) {
723
739
DISPATCHER . with ( |dispatcher| dispatcher. on_grpc_close ( token_id, status_code) )
724
740
}
741
+
742
+ #[ no_mangle]
743
+ pub extern "C" fn proxy_on_foreign_function (
744
+ context_id : u32 ,
745
+ function_id : u32 ,
746
+ arguments_size : usize ,
747
+ ) {
748
+ DISPATCHER
749
+ . with ( |dispatcher| dispatcher. on_foreign_function ( context_id, function_id, arguments_size) )
750
+ }
0 commit comments