Fixes #5941: Synchronize rudder-agent with rudder-agent-thin

Ticket: http://www.rudder-project.org/redmine/issues/5941

To be merged in 3.0