use rwlock for multipeer.