Prevent writing to a socket marked as closed 34/251534/8
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 14 Jan 2021 12:54:15 +0000 (13:54 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 25 Jan 2021 21:30:57 +0000 (22:30 +0100)
commitbf093164536fdeac3cf17e6d1dd27c2b4ae94a18
tree9135fed696817b944fd50554f81e7d87d022dff3
parentf3251fc099fc909c40f4d83bd763243c6f6c0498
Prevent writing to a socket marked as closed

It is possible that select() marks a descriptor as ready for both read
and write operation. If, additionally, the socket becomes closed in
ReadyForRead(), the following call to ReadyForWrite() will attempt to
write to a closed socket. It is harmless, unless the closed descriptor
is already reused by another thread at the time of write().

This commit prevents it.

Change-Id: Idaa829ef74d6df9f24c263f289aeca910b679713
src/manager/main/socket-manager.cpp