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