Fix fail to get Sources in RTSP. the string msg although initially reserved to ZM_NETWORK_BUFSIZ, after use it's capacity is changed whatever it's contents are. So need to re-reserve.

This commit is contained in:
Isaac Connor 2022-01-25 11:55:21 -05:00
parent 3cc243b9a8
commit 26ae5052f4
1 changed files with 1 additions and 0 deletions

View File

@ -245,6 +245,7 @@ class Socket : public CommsBase {
} }
virtual ssize_t recv(std::string &msg) const { virtual ssize_t recv(std::string &msg) const {
msg.reserve(ZM_NETWORK_BUFSIZ);
std::vector<char> buffer(msg.capacity()); std::vector<char> buffer(msg.capacity());
ssize_t nBytes; ssize_t nBytes;
if ((nBytes = ::recv(mSd, buffer.data(), buffer.size(), 0)) < 0) { if ((nBytes = ::recv(mSd, buffer.data(), buffer.size(), 0)) < 0) {