Optimizing Congestion Control in Wireless Sensor Networks Using a Trust-Based, Security-Aware Approach