Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Tests malloc/realloc return values in MemoryDataStream->write #661
Maybe should close the connection when data cannot be stored. The principle of TCP connection is a guaranteed transmission of data. Now we leave part of the data out.
I actually realized that MemoryDataStream update will leak memory if initial malloc succeeds but realloc fails- buf is NULL and won't be freed. Will update the PR later.
Regarding TcpClient- I see your point. However, my update does not break this guarantee- the data which has been accepted for sending is sent. If TcpClient fails to send data (send returns false), application layer knows it right away and can act accordingly. Otherwise, the current implementation will discard data and application will only learn about this later.