benjamin-bader / amanuensis

ah - MAN - you - EN - sis: Web Traffic Inspector
GNU General Public License v3.0
2 stars 0 forks source link

Race condition in TLS tunnels #45

Closed benjamin-bader closed 2 years ago

benjamin-bader commented 2 years ago

TLS tunnels in Transaction have two logical threads of execution - server->client and client->server. When one end shuts down, both handlers might race each other trying to release connections. This leads to access violations, at least on Windows in debug builds.

We should consider ways to prevent this. It's daunting to consider guarding connections with mutexes everywhere; maybe an atomic_bool is_open_ would suffice. Not foolproof, but it could address the shutdown-race.