diff options
author | Sverker Eriksson <[email protected]> | 2018-09-18 14:34:16 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2018-09-18 14:34:16 +0200 |
commit | 06a5b038c1fb5f722b7f691488aaf18981f1344f (patch) | |
tree | 79e415d1a065daac11684ac85de497d9195062b9 /erts/emulator/beam/dist.c | |
parent | fd5ec01f342a885fe1ba0103fe6ece71a85f42f0 (diff) | |
parent | 49504906b4a16b69e52beb09e92f68c6ccd51753 (diff) | |
download | otp-06a5b038c1fb5f722b7f691488aaf18981f1344f.tar.gz otp-06a5b038c1fb5f722b7f691488aaf18981f1344f.tar.bz2 otp-06a5b038c1fb5f722b7f691488aaf18981f1344f.zip |
Merge 'sverker/erts/fix-aborted-pending-connection-race/OTP-15296'
Diffstat (limited to 'erts/emulator/beam/dist.c')
-rw-r--r-- | erts/emulator/beam/dist.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c index 0e2a09cbe9..0633bff3c2 100644 --- a/erts/emulator/beam/dist.c +++ b/erts/emulator/beam/dist.c @@ -3503,13 +3503,11 @@ BIF_RETTYPE erts_internal_new_connection_1(BIF_ALIST_1) BIF_RET(dhandle); } -static Sint abort_connection(DistEntry* dep, Uint32 conn_id) +Sint erts_abort_connection_rwunlock(DistEntry* dep) { - erts_de_rwlock(dep); + ERTS_LC_ASSERT(erts_lc_is_de_rwlocked(dep)); - if (dep->connection_id != conn_id) - ; - else if (dep->state == ERTS_DE_STATE_CONNECTED) { + if (dep->state == ERTS_DE_STATE_CONNECTED) { kill_connection(dep); } else if (dep->state == ERTS_DE_STATE_PENDING) { @@ -3550,17 +3548,19 @@ static Sint abort_connection(DistEntry* dep, Uint32 conn_id) delete_cache(cache); free_de_out_queues(dep, obuf); - return reds; } erts_de_rwunlock(dep); return 0; } -Sint -erts_abort_connection(DistEntry *dep, Uint32 conn_id) +static Sint abort_connection(DistEntry *dep, Uint32 conn_id) { - return abort_connection(dep, conn_id); + erts_de_rwlock(dep); + if (dep->connection_id == conn_id) + return erts_abort_connection_rwunlock(dep); + erts_de_rwunlock(dep); + return 0; } BIF_RETTYPE erts_internal_abort_connection_2(BIF_ALIST_2) |