Callback function invoked when Session wants to receive data from
the remote peer. The implementation of this function must read at
most |data.length| bytes of data and store it in |data|.
It must return the number of
bytes written in |buf| if it succeeds. If it cannot read any
single byte without blocking, it must return
ErrorCode.WOULDBLOCK. If it gets EOF before it reads any
single byte, it must return ErrorCode.EOF. For other
errors, it must return ErrorCode.CALLBACK_FAILURE.
Returning 0 is treated as ErrorCode.WOULDBLOCK.
This callback is required if the application uses
Session.recv to receive data from the remote endpoint.
If the application uses solely http2_session_mem_recv()
instead, this callback function is unnecessary.
Callback function invoked when Session wants to receive data from the remote peer. The implementation of this function must read at most |data.length| bytes of data and store it in |data|.
It must return the number of bytes written in |buf| if it succeeds. If it cannot read any single byte without blocking, it must return ErrorCode.WOULDBLOCK. If it gets EOF before it reads any single byte, it must return ErrorCode.EOF. For other errors, it must return ErrorCode.CALLBACK_FAILURE. Returning 0 is treated as ErrorCode.WOULDBLOCK.
This callback is required if the application uses Session.recv to receive data from the remote endpoint. If the application uses solely http2_session_mem_recv() instead, this callback function is unnecessary.