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 ae17b2316e
commit 988f118ba9
1 changed files with 1 additions and 0 deletions

View File

@ -244,6 +244,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) {