Merge pull request #705 from godarklight/fix-keepalive

Fix keepalive
Optimize incoming server queue when lag is detected.