File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,7 @@ unsafe fn to_str(ptr: *const u8, len: usize) -> String {
240240 String :: from_utf8_lossy ( unsafe { slice:: from_raw_parts ( ptr, len) } ) . into ( )
241241}
242242
243+ #[ cfg( windows) ]
243244unsafe extern "C" fn send_cb (
244245 _: * mut nghttp2_session ,
245246 data : * const u8 ,
@@ -256,6 +257,23 @@ unsafe extern "C" fn send_cb(
256257 }
257258}
258259
260+ #[ cfg( not( windows) ) ]
261+ unsafe extern "C" fn send_cb (
262+ _: * mut nghttp2_session ,
263+ data : * const u8 ,
264+ len : usize ,
265+ _: i32 ,
266+ user_data : * mut std:: os:: raw:: c_void ,
267+ ) -> isize {
268+ unsafe {
269+ let ctx = & mut * ( user_data as * mut Context ) ;
270+ match ctx. stream . write_all ( slice:: from_raw_parts ( data, len) ) {
271+ Ok ( _) => len as isize ,
272+ Err ( _) => NGHTTP2_ERR_CALLBACK_FAILURE as isize ,
273+ }
274+ }
275+ }
276+
259277unsafe extern "C" fn data_cb (
260278 _: * mut nghttp2_session ,
261279 _: u8 ,
You can’t perform that action at this time.
0 commit comments