Protect access to ZRTP state by a mutex
This commit is contained in:
parent
333517c113
commit
ffc24e6b49
|
@ -10,6 +10,7 @@
|
|||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "crypto.hh"
|
||||
|
@ -287,6 +288,8 @@ namespace uvg_rtp {
|
|||
|
||||
zrtp_crypto_ctx_t cctx_;
|
||||
zrtp_session_t session_;
|
||||
|
||||
std::mutex zrtp_mtx_;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -599,6 +599,8 @@ rtp_error_t uvg_rtp::zrtp::init(uint32_t ssrc, socket_t& socket, sockaddr_in& ad
|
|||
|
||||
rtp_error_t uvg_rtp::zrtp::init_dhm(uint32_t ssrc, socket_t& socket, sockaddr_in& addr)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(zrtp_mtx_);
|
||||
|
||||
rtp_error_t ret = RTP_OK;
|
||||
|
||||
/* TODO: set all fields initially to zero */
|
||||
|
@ -695,6 +697,8 @@ rtp_error_t uvg_rtp::zrtp::init_dhm(uint32_t ssrc, socket_t& socket, sockaddr_in
|
|||
|
||||
rtp_error_t uvg_rtp::zrtp::init_msm(uint32_t ssrc, socket_t& socket, sockaddr_in& addr)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(zrtp_mtx_);
|
||||
|
||||
rtp_error_t ret;
|
||||
|
||||
socket_ = socket;
|
||||
|
|
Loading…
Reference in New Issue