sets the connection.state to connected and creates an entry in the name2id index