- start checks with Kimi + many fixes
This commit is contained in:
@@ -591,7 +591,7 @@ UserAgent::SipAddress UserAgent::parseSipAddress(const std::string& sip)
|
||||
if (nameaddr.uri().port())
|
||||
{
|
||||
char porttext[32];
|
||||
sprintf(porttext, ":%u", (unsigned)nameaddr.uri().port());
|
||||
std::snprintf(porttext, sizeof(porttext), ":%u", (unsigned)nameaddr.uri().port());
|
||||
result.mDomain += porttext;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ WatcherQueue::WatcherQueue(UserAgent& ua)
|
||||
WatcherQueue::~WatcherQueue()
|
||||
{}
|
||||
|
||||
int WatcherQueue::add(std::string peer, std::string package, void* tag)
|
||||
int WatcherQueue::add(const std::string& peer, const std::string& package, void* tag)
|
||||
{
|
||||
ice::Lock l(mGuard);
|
||||
|
||||
@@ -16,8 +16,7 @@ int WatcherQueue::add(std::string peer, std::string package, void* tag)
|
||||
for (unsigned i=0; i<mItemList.size(); i++)
|
||||
{
|
||||
Item& item = mItemList[i];
|
||||
if (item.mTarget == peer && item.mPackage == package &&
|
||||
item.mState != Item::State_Deleting)
|
||||
if (item.mTarget == peer && item.mPackage == package && item.mState != Item::State_Deleting)
|
||||
return item.mId;
|
||||
}
|
||||
|
||||
@@ -44,10 +43,9 @@ void WatcherQueue::remove(int id)
|
||||
ice::Lock l(mGuard);
|
||||
|
||||
// Check if queue has similar item
|
||||
for (unsigned i=0; i<mItemList.size(); i++)
|
||||
for (auto& item: mItemList)
|
||||
{
|
||||
Item& item = mItemList[i];
|
||||
if (item.mId == id && !id)
|
||||
if (item.mId == id && id)
|
||||
{
|
||||
if (item.mState != Item::State_Deleting)
|
||||
item.mState = Item::State_ScheduledToDelete;
|
||||
@@ -62,10 +60,9 @@ void WatcherQueue::refresh(int id)
|
||||
ice::Lock l(mGuard);
|
||||
|
||||
// Check if queue has similar item
|
||||
for (unsigned i=0; i<mItemList.size(); i++)
|
||||
for (auto& item: mItemList)
|
||||
{
|
||||
Item& item = mItemList[i];
|
||||
if (item.mId == id && !id)
|
||||
if (item.mId == id && id)
|
||||
{
|
||||
if (item.mState == Item::State_ScheduledToDelete || item.mState == Item::State_Active)
|
||||
item.mState = Item::State_ScheduledToRefresh;
|
||||
@@ -142,9 +139,9 @@ void WatcherQueue::onTerminated(int id, int code)
|
||||
{
|
||||
if (i->mSession)
|
||||
i->mSession->runTerminatedEvent(ResipSession::Type_Subscription, code, 0);
|
||||
mItemList.erase(i);
|
||||
if (i->mId == mActiveId)
|
||||
mActiveId = 0;
|
||||
mItemList.erase(i);
|
||||
}
|
||||
process();
|
||||
}
|
||||
|
||||
@@ -27,16 +27,15 @@ public:
|
||||
State_Deleting
|
||||
};
|
||||
|
||||
resip::ClientSubscriptionHandle mHandle; // Subscription handle
|
||||
ResipSession* mSession;
|
||||
State mState;
|
||||
std::string mTarget; // Target's address
|
||||
std::string mPackage; // Event package
|
||||
void* mTag; // User tag
|
||||
int mId;
|
||||
resip::ClientSubscriptionHandle mHandle; // Subscription handle
|
||||
ResipSession* mSession = nullptr;
|
||||
State mState = State::State_None;
|
||||
std::string mTarget; // Target's address
|
||||
std::string mPackage; // Event package
|
||||
void* mTag = nullptr; // User tag
|
||||
int mId = 0; // Related session ID - it is always non-zero (zero is here for initialization only)
|
||||
|
||||
Item()
|
||||
:mSession(NULL), mState(State_None), mTag(NULL), mId(0)
|
||||
{}
|
||||
|
||||
bool scheduled()
|
||||
@@ -47,7 +46,7 @@ public:
|
||||
WatcherQueue(UserAgent& agent);
|
||||
~WatcherQueue();
|
||||
|
||||
int add(std::string peer, std::string package, void* tag);
|
||||
int add(const std::string& peer, const std::string& package, void* tag);
|
||||
void remove(int id);
|
||||
void refresh(int id);
|
||||
void clear();
|
||||
|
||||
@@ -36,10 +36,10 @@ ResipSessionAppDialog::~ResipSessionAppDialog()
|
||||
std::atomic_int ResipSession::InstanceCounter;
|
||||
|
||||
ResipSession::ResipSession(resip::DialogUsageManager& dum)
|
||||
: resip::AppDialogSet(dum), mUserAgent(NULL), mType(Type_None), mSessionId(0), mSession(0)
|
||||
: resip::AppDialogSet(dum), mUserAgent(nullptr), mType(Type_None), mSessionId(0), mSession(0)
|
||||
{
|
||||
ResipSession::InstanceCounter++;
|
||||
mTag = NULL;
|
||||
mTag = nullptr;
|
||||
mTerminated = false;
|
||||
mOnWatchingStartSent = false;
|
||||
mSessionId = Session::generateId();
|
||||
|
||||
Reference in New Issue
Block a user