Using nghttp2 to send APN push notification

13 Views Asked by At

I am using nghttp2 to send APN2 notification. The basic code was taken from https://github.com/nghttp2/nghttp2/blob/master/examples/client.c

The only difference from the above example is that I keep connection open for sending multiple notifications, but one at a time. Hence I do not call nghttp2_session_terminate_session from on_stream_close_callback. Instead I call nghttp2_session_del when connection is closed by the server.

This worked so far. However, recently our usage increased and I started getting assertion here in nghttp2_session_pack_data function.

https://github.com/nghttp2/nghttp2/blob/master/lib/nghttp2_session.c#L7737

/* Current max DATA length is less then buffer chunk size */
  assert(nghttp2_buf_avail(buf) >= datamax);

The above assert is due to nghttp2 not able to allocate memory.

Do you think this due to I am not calling nghttp2_session_terminate_session. What would be right way to handle this?

Thanks

0

There are 0 best solutions below