Bug fix and code improvement

Signed-off-by: leo-ma <begeekmyfriend@gmail.com>

1. Make access control compatible between AgentX and SNMPv2;
2. Help process some exceptional situations in receiving and sending packets.