session2: protect _set_state() from invalid usage

darcs-hash:20090423091419-b2873-77d6a1cbc15185f41504721670112d2a9da8a724