The server considers the turn based on the sequence user enters in the room. In your case, if the 3rd player leaves the room and a new user joins then the new user will be on the 5th spot i.e. last in the sequence.
You can define your own custom turn mechanism. We have already provided the custom turn management APIs in the cocos2dx SDK to override the default server logic.
You can go through this blog to understand more about the same.
Let me know if you have any further queries.