Instead of copying, move that.
And then later for the local socket assignment
operations use a copy connections map member used
as a destination shortly before.
Closes Coverity CID 642750.
Change-Id: Ief7891c1962251b33cd5960e74e4081685881dcf
Use shared_ptr for automatic reference counting of sockets, instead of
doing it manually through atomic_ref_cnt.
Use shared_ptr instead of raw pointers in all appropriate places.
Add const qualifier for a few methods.
No functional change.
Change-Id: I7db07fd90a2398f0253290aa2d810f8599e3983e
Use a container for the actual objects instead of manually managing
pointers. Switch from vector to deque as AmThread isn't
copy-constructible.
No functional changes.
Change-Id: I1bbcdcd961319b78612c6fa64dd95fdda8e43d2c
Refactor it so, that it's not possible to go over what
`unsigned long` offers (so 4,294,967,295).
We are accumulating read bytes there, which can potentially
be more than proposed 4,3Gb, for that case check out if
the possible end result will overflow and close connection
if this is likely to happen.
Change-Id: I4e758292e77649ddfbcaaa7f8dc9f133e74c4600
Zero is a valid file descriptor. Anything that's not -1 can in fact be a
valid file descriptor.
Make sure `sd` is set to -1 whenever no socket is open.
Add dtor to socket class to close the socket if it's open.
Add a few related formatting fixes as well.
Change-Id: Id9d3ad74b986c82ac6ab698a1e8f1f38e0f92414
read() and write() return ssize_t. Update variables and other affected
class members. Pointer arithmetic also returns ssize_t.
Fixes a potential overflow.
Change-Id: I411ad648777fdba5c0fd59f9f7721a2971b60e1d
Warned-by: Coverity
This commit fixes this warning:
tcp_trsp.cpp: In member function 'virtual void tcp_server_worker::run()':
tcp_trsp.cpp:573:7: warning: ignoring return value of 'int pipe(int*)' declared with attribute 'warn_unused_result' [-Wunused-result]
573 | pipe(fake_fds);
| ~~~~^~~~~~~~~~
Change-Id: I159153c7bad287b9ca9fe25cd775fc79c4de6cf7