Since people are not the same emotionally, there is no universal solution. But IMO, if you truly want a solution, walking away isn't it. That's a bandaid. It can help prevent the situation from getting worse, but it doesn't do a great deal to address the underlying problem.
The best solution is to learn or train yourself not to let beats take you off your game. That was the key ability that reportedly differentiated Chip Reese, possibly the best player ever, from others of similar ability. Of course, this is easier said than done. How to do it probably has a large personal component. But I think one step is not thinking of yourself as a person who tilts. If you do, it smacks of self-fulfilling prophecy.