Adaptive Buffer Management for Efficient Code Dissemination in Multi-Application Wireless Sensor Networks