return kr_error(EIO);
}
} else {
+ retries = 0;
submitted += count;
if (count == 0 && submitted != sizeof(pkt_size) + pkt->size) {
kr_log_error("[tls_client] gnutls_record_uncork didn't send all data: %s (%zd)\n",
if (session->closing) {
return status;
}
+ /* Finalize the task, if any errors.
+ * We can't add it to the end of waiting list for retrying
+ * since it may lead endless loop in some circumstances
+ * (for instance: tls; send->tls_push->too many non-critical errors->
+ * on_send with nonzero status->re-add to waiting->send->etc).*/
if (status != 0) {
- /* Add to the end for retry */
- session_add_waiting(session, task);
+ qr_task_finalize(task, KR_STATE_FAIL);
+ if (session->outgoing) {
+ qr_task_finalize(task, KR_STATE_FAIL);
+ } else {
+ assert(task->ctx->source.session == session);
+ task->ctx->source.session = NULL;
+ }
+ session_del_tasks(session, task);
+ qr_task_unref(task);
}
if (session->waiting.len > 0) {
struct qr_task *t = session->waiting.at[0];