server: update state and counter properly

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>