Skip to content
Snippets Groups Projects
Commit 0ada48d7 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

Fix box.session.peer in box.session.on_disconnect triggers

iproto_connection_close() closes the connection fd and then pushes
the disconnect message to tx, which runs session disconnect triggers.
As a result, box.session.peer() return nil, when called from a
box.session.on_disconnect() trigger, which prevents us from using the
trigger for auditing the disconnect event in the EE version.

Postponing close() until after the disconnect triggers have finished
wouldn't help, because on OS X and BSD, in contrast to Linux,
getpeername() fails if the socket was closed by the other end.

To fix this issue, let's store the peer address in the session meta.

Note, we need to remove box.session.peer() check from box-tap/session
test. The check was added by commit d68050b9 ("Fix on_disconnect
trigger"), which fixed a crash on attempt to use box.session.peer() from
box.session.on_disconnect() trigger. This patch doesn't reintroduce the
crash, but instead fixes the bug in a more extensive way and adds a
dedicated test.

Closes #7014

NO_DOC=bug fix
parent 7e5db095
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment