refactor server_replication
1. refactor session  "Handling control requests"
2. fix code style problems
Merge pull request #443 from xmujay/0616_server_replication

refactor server_replication: 1. refactor session  "Handling control requests" 2. fix code style problems