Skip to content

Commit

Permalink
Fix common rtorrent xml-rpc crash when trying to queue an invalid task
Browse files Browse the repository at this point in the history
Instead of throwing an internal error and terminating the client, it's better not to queue the invalid task in the first place.
`C Caught internal_error: 'priority_queue_insert(...) called on an invalid item.'.`
  • Loading branch information
stickz authored Nov 28, 2021
1 parent 8cafb55 commit 4abaa26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rpc/command_scheduler_item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ CommandSchedulerItem::enable(rak::timer t) {

if (is_queued())
disable();

// Don't schedule invalid tasks for rpc commands
if (!m_task.is_valid())
return;

// If 'first' is zero then we execute the task
// immediately. ''interval()'' will not return zero so we never end
// up in an infinit loop.
// up in an infinite loop.
m_timeScheduled = t;
priority_queue_insert(&taskScheduler, &m_task, t);
}
Expand Down

0 comments on commit 4abaa26

Please sign in to comment.