Refactor SocketManager's timeout queue 00/251400/10
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 13 Jan 2021 09:40:17 +0000 (10:40 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 25 Jan 2021 21:30:50 +0000 (22:30 +0100)
commitf3251fc099fc909c40f4d83bd763243c6f6c0498
treeaa1907b7b027aa456f14c29191ff6859375af830
parent458c2cbe8bff78708bcc27ece4c79b7714037cd3
Refactor SocketManager's timeout queue

SocketManager changes:
* Remove timeout queue elements on socket closure. Until now it was
  possible to make the timeout queue grow because its elements were not
  removed upon socket closure.
* The queue now contains only socket numbers of corresponding
  m_socketDescriptionVector elements. The code responsible for timeout
  updates in the queue is no longer neccessary and has been removed.
* Modify the timeout queue only if corresponding socket has a timeout
  enabled.
* Remove unnecessary 'open' and 'timeout' socket flag check if a
  timeout occurs. Only the main thread modifies these flags. If there's
  a timeout, it must have been triggered by an opened socket with
  timeout enabled.

Growing queue test changes:
* Compare timeout queue size and connection count in the SocketManager
  thread.
* Assume that first AcceptEvent is triggered by the most reccent
  connection attempt.
* Match client and server sockets to properly detect CloseEvents.
* Add more stress to the test with more initial connections.
* Throw std exceptions from SocketManager thread.
* Wrap SocketManager thread in an object. Check a possible exception in
  the destructor.
* Get rid of unnecessary timeouts.

Change-Id: Icd63696a58c4ef6a66c2e487819423df610ca580
src/manager/main/socket-manager.cpp
src/manager/main/socket-manager.h
unit-tests/test_socket-manager.cpp