Browse Source

[throttle] Fix segfaults

personal/stbuehler/wip
Stefan Bühler 11 years ago
parent
commit
bf0ece96fb
  1. 4
      src/main/connection.c
  2. 4
      src/main/throttle.c

4
src/main/connection.c

@ -598,10 +598,10 @@ void li_connection_reset(liConnection *con) {
li_buffer_release(con->raw_in_buffer);
con->raw_in_buffer = NULL;
li_throttle_reset(con->mainvr);
li_vrequest_reset(con->mainvr, FALSE);
li_throttle_reset(con->mainvr);
/* restore chunkqueue limits */
li_chunkqueue_set_limit(con->raw_in, con->in->limit);
li_chunkqueue_set_limit(con->raw_out, con->out->limit);

4
src/main/throttle.c

@ -337,7 +337,7 @@ void li_throttle_cb(liWaitQueue *wq, gpointer data) {
vr->throttle.magazine += vr->throttle.con.rate / 1000 * THROTTLE_GRANULARITY;
}
vr->coninfo->callbacks->handle_check_io(vr);
if (!vr->coninfo->callbacks->handle_check_io(vr)) continue; /* vr got reset */
if (vr->throttle.magazine <= 0)
li_throttle_update(vr, 0, 0);
@ -346,6 +346,8 @@ void li_throttle_cb(liWaitQueue *wq, gpointer data) {
}
void li_throttle_update(liVRequest *vr, goffset transferred, goffset write_max) {
assert(vr->state != LI_VRS_CLEAN);
vr->throttle.magazine -= transferred;
if (vr->throttle.magazine <= 0) {

Loading…
Cancel
Save