if callee_id not in self.peers:
await ws.send('ERROR peer {!r} not found'.format(callee_id))
continue
- if self.peers[callee_id][2] is not None:
+ if peer_status is not None:
+ await ws.send('ERROR you are already in a session, reconnect '
+ 'to the server to start a new session, or use'
+ 'a ROOM for multi-peer sessions')
+ continue
+ callee_status = self.peers[callee_id][2]
+ if callee_status is not None:
await ws.send('ERROR peer {!r} busy'.format(callee_id))
continue
await ws.send('SESSION_OK')