/** * RX data indication callback used to give us some new Gnet traffic in a * low-level message structure (which can contain several Gnet messages). * * @return FALSE if an error occurred. */ static bool thex_download_data_ind(rxdrv_t *rx, pmsg_t *mb) { struct thex_download *ctx = rx_owner(rx); struct download *d; bool error; d = ctx->owner; download_check(d); /* * When we receive THEX data with an advertised size, the remote * end will simply stop emitting data when we're done and could maintain * the HTTP connection alive. Therefore, since we don't intend to * issue any more request on that connection, we must check for completion. * * When chunked data is received (unknown size), the last chunk will * trigger completion via an RX-callback invoked from the dechunking * layer, but in that case it is harmless to make the call anyway. */ error = thex_download_data_read(ctx, mb); if (!error) { download_maybe_finished(d); download_check(d); } pmsg_free(mb); return !error && DOWNLOAD_IS_RUNNING(d); }
/** * RX data indication callback used to give us some new Gnet traffic in a * low-level message structure (which can contain several Gnet messages). * * @return FALSE if an error occurred. */ static gboolean browse_data_ind(rxdrv_t *rx, pmsg_t *mb) { struct browse_ctx *bc = rx_owner(rx); struct download *d; gboolean error = FALSE; while (browse_data_read(bc, mb)) { if (!browse_data_process(bc)) { error = TRUE; break; } } /* * When we receive browse-host data with an advertised size, the remote * end will simply stop emitting data when we're done and could maintain * the HTTP connection alive. Therefore, since we don't intend to * issue any more request on that connection, we must check for completion. * * When chunked data is received (unknown size), the last chunk will * trigger completion via an RX-callback invoked from the dechunking * layer, but in that case it is harmless to make the call anyway. */ d = bc->owner; download_check(d); if (!error) { download_maybe_finished(d); download_check(d); } pmsg_free(mb); return !error && DOWNLOAD_IS_RUNNING(d); }