When cs_get returns 0 the association is marked dead, rather then
being destroyed. If not, the session memory is being free'd before
the search/scan handler is finished. Also destroy request memory
in request_release rather than in various places, which resulted in
leaks from time to time.
void request_release(request *r)
{
request_q *q = r->q;
void request_release(request *r)
{
request_q *q = r->q;
+ if (r->request_mem)
+ nmem_destroy(r->request_mem);
r->next = q->list;
q->list = r;
}
r->next = q->list;
q->list = r;
}
if ((assoc->cs_put_mask & EVENT_INPUT) == 0 && (event & assoc->cs_get_mask))
{
if ((assoc->cs_put_mask & EVENT_INPUT) == 0 && (event & assoc->cs_get_mask))
{
- yaz_log(YLOG_DEBUG, "ir_session (input)");
/* We aren't speaking to this fellow */
if (assoc->state == ASSOC_DEAD)
{
/* We aren't speaking to this fellow */
if (assoc->state == ASSOC_DEAD)
{
- yaz_log(log_sessiondetail, "Connection closed - end of session");
+ yaz_log(log_session, "Connection closed - end of session");
cs_close(conn);
destroy_association(assoc);
iochan_destroy(h);
cs_close(conn);
destroy_association(assoc);
iochan_destroy(h);
+ assoc->state = ASSOC_DEAD;
yaz_log(log_session, "Connection closed by client");
yaz_log(log_session, "Connection closed by client");
- cs_close(conn);
- destroy_association(assoc);
- iochan_destroy(h);
return 0;
}
else if (res == 1) /* incomplete read - wait for more */
return 0;
}
else if (res == 1) /* incomplete read - wait for more */
yaz_log(YLOG_DEBUG, "HTTP out:\n%.*s", req->len_response,
req->response);
#endif
yaz_log(YLOG_DEBUG, "HTTP out:\n%.*s", req->len_response,
req->response);
#endif
- nmem_destroy(req->request_mem);
request_deq(&assoc->outgoing);
request_release(req);
if (!request_head(&assoc->outgoing))
request_deq(&assoc->outgoing);
request_release(req);
if (!request_head(&assoc->outgoing))