MT#62181 use shared_ptr for msg_logger

Use shared_ptr for reference counting instead of hand-rolling it.

Change-Id: I147dd6df4e302a2400b184aa88775cf635a57506
mr13.5
Richard Fuchs 11 months ago
parent 83c8a58651
commit 8083dcd92f

@ -671,7 +671,7 @@ bool RegisterCache::findAEByContact(const string& contact_uri,
int RegisterCache::parseAoR(RegisterCacheCtx& ctx,
const AmSipRequest& req,
msg_logger *logger)
const shared_ptr<msg_logger>& logger)
{
if(ctx.aor_parsed)
return 0;
@ -698,14 +698,14 @@ int RegisterCache::parseAoR(RegisterCacheCtx& ctx,
int RegisterCache::parseContacts(RegisterCacheCtx& ctx,
const AmSipRequest& req,
msg_logger *logger)
const shared_ptr<msg_logger>& logger)
{
if(ctx.contacts_parsed)
return 0;
if ((RegisterDialog::parseContacts(req.contact, ctx.contacts) < 0) ||
(ctx.contacts.size() == 0)) {
AmBasicSipDialog::reply_error(req, 400, "Bad Request",
AmBasicSipDialog::reply_error(req, 400, "Bad Request",
"Warning: Malformed contact\r\n", logger);
return -1;
}
@ -715,7 +715,7 @@ int RegisterCache::parseContacts(RegisterCacheCtx& ctx,
int RegisterCache::parseExpires(RegisterCacheCtx& ctx,
const AmSipRequest& req,
msg_logger *logger)
const shared_ptr<msg_logger>& logger)
{
if(ctx.expires_parsed)
return 0;
@ -723,7 +723,7 @@ int RegisterCache::parseExpires(RegisterCacheCtx& ctx,
// move Expires as separate header to contact parameter
string expires_str = getHeader(req.hdrs, "Expires");
if (!expires_str.empty() && str2int(expires_str, ctx.requested_expires)) {
AmBasicSipDialog::reply_error(req, 400, "Bad Request",
AmBasicSipDialog::reply_error(req, 400, "Bad Request",
"Warning: Malformed expires\r\n", logger);
return true; // error reply sent
}
@ -733,7 +733,7 @@ int RegisterCache::parseExpires(RegisterCacheCtx& ctx,
bool RegisterCache::throttleRegister(RegisterCacheCtx& ctx,
const AmSipRequest& req,
msg_logger *logger)
const shared_ptr<msg_logger>& logger)
{
if (req.method != SIP_METH_REGISTER) {
ERROR("unsupported method '%s'\n", req.method.c_str());
@ -863,7 +863,7 @@ bool RegisterCache::throttleRegister(RegisterCacheCtx& ctx,
bool RegisterCache::saveSingleContact(RegisterCacheCtx& ctx,
const AmSipRequest& req,
msg_logger *logger)
const shared_ptr<msg_logger>& logger)
{
if (req.method != SIP_METH_REGISTER) {
ERROR("unsupported method '%s'\n", req.method.c_str());

@ -313,9 +313,9 @@ protected:
sleep_cond.notify_all();
}
int parseAoR(RegisterCacheCtx& ctx, const AmSipRequest& req, msg_logger *logger);
int parseContacts(RegisterCacheCtx& ctx, const AmSipRequest& req, msg_logger *logger);
int parseExpires(RegisterCacheCtx& ctx, const AmSipRequest& req, msg_logger *logger);
int parseAoR(RegisterCacheCtx& ctx, const AmSipRequest& req, const shared_ptr<msg_logger>& logger);
int parseContacts(RegisterCacheCtx& ctx, const AmSipRequest& req, const shared_ptr<msg_logger>& logger);
int parseExpires(RegisterCacheCtx& ctx, const AmSipRequest& req, const shared_ptr<msg_logger>& logger);
void setAliasUATimer(AliasEntry* alias_e);
void removeAliasUATimer(AliasEntry* alias_e);
@ -408,7 +408,7 @@ public:
*/
bool throttleRegister(RegisterCacheCtx& ctx,
const AmSipRequest& req,
msg_logger *logger = NULL);
const shared_ptr<msg_logger>& logger = NULL);
/**
* Save a single REGISTER contact into cache
@ -417,7 +417,7 @@ public:
* - if request is not a REGISTER.
* - more than one contact should be (un)registered.
*
* If true has been returned, the request has already
* If true has been returned, the request has already
* been replied with either an error or 200 (w/ contact).
*
* Note: this function also handles binding query.
@ -425,7 +425,7 @@ public:
*/
bool saveSingleContact(RegisterCacheCtx& ctx,
const AmSipRequest& req,
msg_logger *logger = NULL);
const shared_ptr<msg_logger>& logger = NULL);
/**
* Statistics

@ -318,7 +318,7 @@ AmSession* SBCFactory::onInvite(const AmSipRequest& req, const string& app_name,
SBCCallLeg* b2b_dlg = callLegCreator->create(call_profile);
msg_logger* logger = b2b_dlg->getCallProfile().get_logger(req);
auto logger = b2b_dlg->getCallProfile().get_logger(req);
if (logger && call_profile.log_sip) req.log(logger);
if (call_profile.auth_aleg_enabled) {
@ -379,7 +379,7 @@ void SBCFactory::onOoDRequest(const AmSipRequest& req)
SBCCallProfile call_profile(*p_call_profile);
profiles_mut.unlock();
msg_logger* logger = call_profile.get_logger(req);
auto logger = call_profile.get_logger(req);
if (logger && call_profile.log_sip) req.log(logger);
ctx.call_profile = &call_profile;

@ -513,7 +513,6 @@ SBCCallLeg::~SBCCallLeg()
{
if (auth)
delete auth;
if (logger) dec_ref(logger);
}
void SBCCallLeg::onBeforeDestroy()
@ -1209,7 +1208,7 @@ bool SBCCallLeg::CCStart(const AmSipRequest& req) {
if (!logger) {
// open the logger if not already opened
msg_logger *l = call_profile.get_logger(req);
auto l = call_profile.get_logger(req);
if (l) setLogger(l);
}
@ -1949,11 +1948,10 @@ void SBCCallLeg::setMediaSession(AmB2BMedia *new_session)
bool SBCCallLeg::openLogger(const std::string &path)
{
file_msg_logger *log = new pcap_logger();
shared_ptr<file_msg_logger> log(new pcap_logger());
if(log->open(path.c_str()) != 0) {
// open error
delete log;
return false;
}
@ -1962,12 +1960,9 @@ bool SBCCallLeg::openLogger(const std::string &path)
return true;
}
void SBCCallLeg::setLogger(msg_logger *_logger)
void SBCCallLeg::setLogger(const shared_ptr<msg_logger>& _logger)
{
if (logger) dec_ref(logger); // release the old one
logger = _logger;
if (logger) inc_ref(logger);
if (call_profile.log_sip) dlg->setMsgLogger(logger);
else dlg->setMsgLogger(NULL);

@ -86,9 +86,9 @@ class SBCCallLeg : public CallLeg, public CredentialHolder
list<atomic_int*> rtp_pegs;
/** common logger for RTP/RTCP and SIP packets */
msg_logger *logger;
shared_ptr<msg_logger> logger;
void setLogger(msg_logger *_logger);
void setLogger(const shared_ptr<msg_logger>& _logger);
void fixupCCInterface(const string& val, CCInterface& cc_if);
@ -257,7 +257,7 @@ class SBCCallLeg : public CallLeg, public CredentialHolder
int applySSTCfg(AmConfigReader& sst_cfg, const AmSipRequest* p_req);
bool openLogger(const std::string &path);
msg_logger *getLogger() { return logger; }
const shared_ptr<msg_logger>& getLogger() { return logger; }
virtual double get491RetryTime() { return (get_random() % call_profile.max_491_retry_time) / 1000.0; }
};

@ -26,6 +26,7 @@
#include "SBCCallProfile.h"
#include "SBC.h"
#include <algorithm>
#include <memory>
#include "log.h"
#include "AmUtils.h"
@ -39,6 +40,7 @@
#include "sip/pcap_logger.h"
using std::make_shared;
typedef vector<SdpPayload>::iterator PayloadIterator;
static string payload2str(const SdpPayload &p);
@ -1673,22 +1675,21 @@ void SBCCallProfile::create_logger(const AmSipRequest& req)
string log_path = ctx.replaceParameters(msg_logger_path, "msg_logger_path", req);
if (log_path.empty()) return;
file_msg_logger *log = new pcap_logger();
auto log = make_shared<pcap_logger>();
if(log->open(log_path.c_str()) != 0) {
// open error
delete log;
return;
}
// opened successfully
logger.reset(log);
logger = log;
}
msg_logger* SBCCallProfile::get_logger(const AmSipRequest& req)
const shared_ptr<msg_logger>& SBCCallProfile::get_logger(const AmSipRequest& req)
{
if (!logger.get() && !msg_logger_path.empty()) create_logger(req);
return logger.get();
return logger;
}
//////////////////////////////////////////////////////////////////////////////////
@ -1697,7 +1698,7 @@ bool PayloadDesc::match(const SdpPayload &p) const
{
string enc_name = p.encoding_name;
transform(enc_name.begin(), enc_name.end(), enc_name.begin(), ::tolower);
if ((name.size() > 0) && (name != enc_name)) return false;
if (clock_rate && (p.clock_rate > 0) && clock_rate != (unsigned)p.clock_rate) return false;
return true;

@ -61,24 +61,6 @@ typedef std::list<CCInterface> CCInterfaceListT;
typedef CCInterfaceListT::iterator CCInterfaceListIteratorT;
typedef CCInterfaceListT::const_iterator CCInterfaceListConstIteratorT;
template <class T>
class ref_counted_ptr
{
private:
T *ptr;
public:
void reset(T *p) { if (ptr) dec_ref(ptr); ptr = p; if (ptr) inc_ref(ptr); }
T *get() const { return ptr; }
ref_counted_ptr(): ptr(0) { }
~ref_counted_ptr() { if (ptr) dec_ref(ptr); }
ref_counted_ptr(const ref_counted_ptr &other): ptr(other.ptr) { if (ptr) inc_ref(ptr); }
ref_counted_ptr &operator=(const ref_counted_ptr &other) { reset(other.ptr); return *this; }
};
class PayloadDesc {
protected:
std::string name;
@ -328,7 +310,7 @@ struct SBCCallProfile
private:
// message logging feature
string msg_logger_path;
ref_counted_ptr<msg_logger> logger;
shared_ptr<msg_logger> logger;
void create_logger(const AmSipRequest& req);
@ -336,7 +318,7 @@ struct SBCCallProfile
bool log_rtp;
bool log_sip;
bool has_logger() { return logger.get() != NULL; }
msg_logger* get_logger(const AmSipRequest& req);
const shared_ptr<msg_logger>& get_logger(const AmSipRequest& req);
void set_logger_path(const std::string path) { msg_logger_path = path; }
const string &get_logger_path() { return msg_logger_path; }

@ -513,7 +513,6 @@ AmB2BMedia::AmB2BMedia(AmB2BSession *_a, AmB2BSession *_b):
AmB2BMedia::~AmB2BMedia()
{
if (logger) dec_ref(logger);
}
void AmB2BMedia::addToMediaProcessor() {
@ -1203,11 +1202,9 @@ void AmB2BMedia::createHoldAnswer(bool a_leg, const AmSdp &offer, AmSdp &answer,
}
}
void AmB2BMedia::setRtpLogger(msg_logger* _logger)
void AmB2BMedia::setRtpLogger(const shared_ptr<msg_logger>& _logger)
{
if (logger) dec_ref(logger);
logger = _logger;
if (logger) inc_ref(logger);
// walk through all the streams and use logger for them
for (AudioStreamIterator i = audio.begin(); i != audio.end(); ++i) i->setLogger(logger);

@ -211,7 +211,7 @@ class AudioStreamData {
void setInput(AmAudio *_in) { in = _in; }
AmAudio *getInput() { return in; }
void setLogger(msg_logger *logger) { if (stream) stream->setLogger(logger); }
void setLogger(const shared_ptr<msg_logger>& logger) { if (stream) stream->setLogger(logger); }
void debug();
};
@ -297,14 +297,14 @@ class AmB2BMedia: public AmMediaSession
AudioStreamData a, b;
int media_idx;
AudioStreamPair(AmB2BSession *_a, AmB2BSession *_b, int _media_idx): a(_a), b(_b), media_idx(_media_idx) { }
void setLogger(msg_logger *logger) { a.setLogger(logger); b.setLogger(logger); }
void setLogger(const shared_ptr<msg_logger>& logger) { a.setLogger(logger); b.setLogger(logger); }
bool requiresProcessing() { return a.getInput() || b.getInput(); }
};
struct RelayStreamPair {
AmRtpStream a, b;
RelayStreamPair(AmB2BSession *_a, AmB2BSession *_b);
void setLogger(msg_logger *logger) { a.setLogger(logger); b.setLogger(logger); }
void setLogger(const shared_ptr<msg_logger>& logger) { a.setLogger(logger); b.setLogger(logger); }
};
typedef std::vector<AudioStreamPair>::iterator AudioStreamIterator;
@ -356,7 +356,7 @@ class AmB2BMedia: public AmMediaSession
void setMuteFlag(bool a_leg, bool set);
void changeSessionUnsafe(bool a_leg, AmB2BSession *new_session);
msg_logger* logger; // log RTP traffic
shared_ptr<msg_logger> logger; // log RTP traffic
virtual ~AmB2BMedia();
@ -472,7 +472,7 @@ class AmB2BMedia: public AmMediaSession
void setFirstStreamInput(bool a_leg, AmAudio *in);
void createHoldAnswer(bool a_leg, const AmSdp &offer, AmSdp &answer, bool use_zero_con);
void setRtpLogger(msg_logger* _logger);
void setRtpLogger(const shared_ptr<msg_logger>& _logger);
/** enable or disable DTMF receiving on relay streams */
void setRelayDTMFReceiving(bool enabled);

@ -44,7 +44,6 @@ AmBasicSipDialog::~AmBasicSipDialog()
{
termUasTrans();
termUacTrans();
if (logger) dec_ref(logger);
dump();
}
@ -666,9 +665,9 @@ int AmBasicSipDialog::reply(const AmSipRequest& req,
/* static */
int AmBasicSipDialog::reply_error(const AmSipRequest& req, unsigned int code,
int AmBasicSipDialog::reply_error(const AmSipRequest& req, unsigned int code,
const string& reason, const string& hdrs,
msg_logger* logger)
const shared_ptr<msg_logger>& logger)
{
AmSipReply reply;
@ -787,21 +786,13 @@ void AmBasicSipDialog::dump()
if(uas_trans.size()){
for(TransMap::iterator it = uas_trans.begin();
it != uas_trans.end(); it++){
ILOG_DLG(L_DBG, " cseq = %i; method = %s\n",it->first,it->second.method.c_str());
}
}
}
void AmBasicSipDialog::setMsgLogger(msg_logger* logger)
void AmBasicSipDialog::setMsgLogger(const shared_ptr<msg_logger>& logger)
{
if(this->logger) {
dec_ref(this->logger);
}
if(logger){
inc_ref(logger);
}
this->logger = logger;
}

@ -132,7 +132,7 @@ protected:
/**
* Message logger
*/
msg_logger* logger;
shared_ptr<msg_logger> logger;
/**
* Executed for replies sent by a local UA,
@ -400,15 +400,15 @@ public:
* This method should only be used to send responses
* to requests which are not referenced by any dialog.
*
* WARNING: If the request has already been referenced
* (see uas_trans), this method cannot mark the request
* WARNING: If the request has already been referenced
* (see uas_trans), this method cannot mark the request
* as replied, thus leaving it in the pending state forever.
*/
static int reply_error(const AmSipRequest& req,
unsigned int code,
const string& reason,
const string& hdrs = "",
msg_logger* logger = NULL);
const shared_ptr<msg_logger>& logger = NULL);
/* dump transaction information (DBG) */
void dump();
@ -416,12 +416,12 @@ public:
/**
* Enable or disable message logger
*/
void setMsgLogger(msg_logger* logger);
void setMsgLogger(const shared_ptr<msg_logger>& logger);
/**
* Get message logger
*/
msg_logger* getMsgLogger() { return logger; }
const shared_ptr<msg_logger>& getMsgLogger() { return logger; }
};
/**

@ -282,13 +282,13 @@ int AmRtpPacket::recv(int sd)
return ret;
}
void AmRtpPacket::logReceived(msg_logger *logger, struct sockaddr_storage *laddr)
void AmRtpPacket::logReceived(const shared_ptr<msg_logger>& logger, struct sockaddr_storage *laddr)
{
static const cstring empty;
logger->log((const char *)buffer, b_size, &addr, laddr, empty);
}
void AmRtpPacket::logSent(msg_logger *logger, struct sockaddr_storage *laddr)
void AmRtpPacket::logSent(const shared_ptr<msg_logger>& logger, struct sockaddr_storage *laddr)
{
static const cstring empty;
logger->log((const char *)buffer, b_size, laddr, &addr, empty);

@ -31,6 +31,9 @@
#include <sys/time.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <memory>
using std::shared_ptr;
class AmRtpPacketTracer;
class msg_logger;
@ -81,8 +84,8 @@ public:
unsigned char* getBuffer();
void setBufferSize(unsigned int b) { b_size = b; }
void logReceived(msg_logger *logger, struct sockaddr_storage *laddr);
void logSent(msg_logger *logger, struct sockaddr_storage *laddr);
void logReceived(const shared_ptr<msg_logger>& logger, struct sockaddr_storage *laddr);
void logSent(const shared_ptr<msg_logger>& logger, struct sockaddr_storage *laddr);
};
#endif

@ -132,7 +132,6 @@ AmRtpSocket::AmRtpSocket(AmRtpSocketPair* listener, int interface,
AmRtpSocket::~AmRtpSocket()
{
if (logger) dec_ref(logger);
if(l_sd) {
close(l_sd);
}
@ -229,12 +228,10 @@ void AmRtpSocket::setRemoteAddress(const string& addr, unsigned short port)
am_set_port(&r_saddr, port);
}
void AmRtpSocket::setLogger(msg_logger *_logger)
void AmRtpSocket::setLogger(const shared_ptr<msg_logger>& _logger)
{
// Set logger
if (logger) dec_ref(logger);
logger = _logger;
if (logger) inc_ref(logger);
}

@ -33,8 +33,10 @@
#include <event2/event.h>
#include <netinet/in.h>
#include <string>
#include <memory>
using std::string;
using std::shared_ptr;
class AmRtpSocketPair;
class AmRtpPacket;
@ -54,7 +56,7 @@ class AmRtpSocket
static void read_cb(evutil_socket_t sd, short what, void* arg);
protected:
msg_logger *logger;
shared_ptr<msg_logger> logger;
AmRtpSocketPair* listener;
@ -113,7 +115,7 @@ public:
inline int getLocalPort() { return am_get_port(&l_saddr); };
/** set destination for logging all received/sent RTP and RTCP packets */
void setLogger(msg_logger *_logger);
void setLogger(const shared_ptr<msg_logger>& _logger);
AmRtpSocket(AmRtpSocketPair* listener, int interface, const string& ip,
unsigned int port);

@ -443,7 +443,6 @@ AmRtpStream::~AmRtpStream()
close(l_sd);
close(l_rtcp_sd);
}
if (logger) dec_ref(logger);
}
int AmRtpStream::getLocalPort()
@ -1320,11 +1319,9 @@ inline void PacketMem::clear()
n_used = cur_idx = 0;
}
void AmRtpStream::setLogger(msg_logger* _logger)
void AmRtpStream::setLogger(const shared_ptr<msg_logger>& _logger)
{
if (logger) dec_ref(logger);
logger = _logger;
if (logger) inc_ref(logger);
}
void AmRtpStream::debug()

@ -274,7 +274,7 @@ protected:
/** Session owning this stream */
AmSession* session;
msg_logger *logger;
shared_ptr<msg_logger> logger;
/** Payload provider */
AmPayloadProvider* payload_provider;
@ -514,7 +514,7 @@ public:
void changeSession(AmSession *_s) { session = _s; }
/** set destination for logging all received/sent RTP and RTCP packets */
void setLogger(msg_logger *_logger);
void setLogger(const shared_ptr<msg_logger>& _logger);
void debug();
};

@ -53,6 +53,8 @@
#include <termios.h>
#include <sys/ioctl.h>
using std::make_shared;
#define GET_CALL_ID() (dlg->getCallid().c_str())
unsigned int AmSession::session_num = 0;
@ -128,7 +130,7 @@ AmSession::~AmSession()
{
for(vector<AmSessionEventHandler*>::iterator evh = ev_handlers.begin();
evh != ev_handlers.end(); evh++) {
if((*evh)->destroy)
delete *evh;
}

@ -160,7 +160,7 @@ protected:
AmCondition sess_stopped;
/** this is the group the media is processed with
/** this is the group the media is processed with
- by default local tag */
string callgroup;

@ -254,7 +254,7 @@ string AmSipRequest::print() const
}
void AmSipRequest::log(msg_logger *logger) const
void AmSipRequest::log(const shared_ptr<msg_logger>& logger) const
{
tt.lock_bucket();
const sip_trans* t = tt.get_trans();

@ -102,14 +102,14 @@ class AmSipRequest : public _AmSipMsgInDlg
AmSipRequest();
~AmSipRequest() { }
string print() const;
void log(msg_logger *logger) const;
void log(const shared_ptr<msg_logger>& logger) const;
};
string getHeader(const string& hdrs,const string& hdr_name, bool single = false);
string getHeader(const string& hdrs,const string& hdr_name,
string getHeader(const string& hdrs,const string& hdr_name,
const string& compact_hdr_name, bool single = false);
/** find a header, starting from char skip

@ -223,10 +223,8 @@ int SipCtrlInterface::cancel(trans_ticket* tt, const string& dialog_id,
}
int SipCtrlInterface::send(AmSipRequest &req, const string& dialog_id,
const string& next_hop,
int out_interface,
unsigned int flags,
msg_logger* logger)
const string& next_hop, int out_interface,
unsigned int flags, const shared_ptr<msg_logger>& logger)
{
if (req.method == "CANCEL")
return cancel(&req.tt, dialog_id, req.cseq, req.hdrs);
@ -369,7 +367,7 @@ void SipCtrlInterface::cleanup()
}
int SipCtrlInterface::send(const AmSipReply &rep, const string& dialog_id,
msg_logger* logger)
const shared_ptr<msg_logger>& logger)
{
sip_msg msg;

@ -103,7 +103,7 @@ public:
*/
static int send(AmSipRequest &req, const string& dialog_id,
const string& next_hop = "", int outbound_interface = -1,
unsigned int flags = 0, msg_logger* logger = NULL);
unsigned int flags = 0, const shared_ptr<msg_logger>& logger = NULL);
/**
* Sends a SIP reply.
@ -112,7 +112,7 @@ public:
* ticket included in the SIP request.
*/
static int send(const AmSipReply &rep, const string& dialog_id,
msg_logger* logger = NULL);
const shared_ptr<msg_logger>& logger = NULL);
/**
* CANCELs an INVITE transaction.

@ -14,7 +14,6 @@ using std::string;
struct sockaddr_storage;
class msg_logger
: public atomic_ref_cnt
{
public:
msg_logger() {}

@ -96,9 +96,6 @@ sip_trans::~sip_trans()
if(dialog_id.s) {
delete [] dialog_id.s;
}
if(logger) {
dec_ref(logger);
}
}
/**

@ -156,7 +156,7 @@ class sip_trans
unsigned int flags;
/** message logging */
msg_logger* logger;
shared_ptr<msg_logger> logger;
/** request canceled? */
bool canceled;

@ -217,7 +217,7 @@ static int patch_contact_transport(sip_header* contact, const cstring& trsp,
int trans_layer::send_reply(sip_msg* msg, const trans_ticket* tt,
const cstring& dialog_id, const cstring& to_tag,
msg_logger* logger)
const shared_ptr<msg_logger>& logger)
{
// Ref.: RFC 3261 8.2.6, 12.1.1
//
@ -629,7 +629,6 @@ int trans_layer::send_reply(sip_msg* msg, const trans_ticket* tt,
if(!t->logger){
t->logger = logger;
inc_ref(logger);
}
}
@ -1202,7 +1201,7 @@ int trans_layer::send_request(sip_msg* msg, trans_ticket* tt,
const cstring& dialog_id,
const cstring& _next_hop,
int out_interface, unsigned int flags,
msg_logger* logger)
const shared_ptr<msg_logger>& logger)
{
// Request-URI
// To
@ -1346,7 +1345,7 @@ int trans_layer::send_request(sip_msg* msg, trans_ticket* tt,
}
}
DBG("logger = %p\n",logger);
DBG("logger = %p\n",logger.get());
if(logger) {
sockaddr_storage src_ip;
@ -1373,7 +1372,6 @@ int trans_layer::send_request(sip_msg* msg, trans_ticket* tt,
if(tt->_t && !tt->_t->logger) {
tt->_t->logger = logger;
inc_ref(logger);
}
}
@ -1558,7 +1556,6 @@ int trans_layer::cancel(trans_ticket* tt, const cstring& dialog_id,
if(!cancel_t->logger) {
cancel_t->logger = t->logger;
inc_ref(t->logger);
}
}
}
@ -2624,7 +2621,6 @@ sip_trans* trans_layer::copy_uac_trans(sip_trans* tr)
if(tr->logger) {
n_tr->logger = tr->logger;
inc_ref(n_tr->logger);
}
return n_tr;

@ -170,7 +170,8 @@ public:
* 'Content-Length' header.
*/
int send_reply(sip_msg* msg, const trans_ticket* tt, const cstring& dialog_id,
const cstring& to_tag, msg_logger* logger=NULL);
const cstring& to_tag,
const shared_ptr<msg_logger>& logger=NULL);
/**
* Sends a UAC request.
@ -181,7 +182,7 @@ public:
*/
int send_request(sip_msg* msg, trans_ticket* tt, const cstring& dialog_id,
const cstring& _next_hop, int out_interface = -1,
unsigned int flags=0, msg_logger* logger=NULL);
unsigned int flags=0, const shared_ptr<msg_logger>& logger=NULL);
/**
* Cancels a request.

Loading…
Cancel
Save