Skip to content

Commit

Permalink
fix for #386 (#391)
Browse files Browse the repository at this point in the history
* fix for #386

* copyright notice
  • Loading branch information
davehorton authored Nov 21, 2024
1 parent a592b70 commit 92bfc9c
Show file tree
Hide file tree
Showing 28 changed files with 68 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/cdr.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/client-controller.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/client-controller.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/client.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/client.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/controller.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/controller.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/drachtio-config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/drachtio-config.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/drachtio.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/drachtio.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************
The MIT License (MIT)
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/pending-request-controller.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/pending-request-controller.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 8 additions & 2 deletions src/request-handler.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -438,7 +438,13 @@ namespace drachtio {
m_thread.swap( t ) ;
}
RequestHandler::~RequestHandler() {
curl_multi_cleanup(m_g.multi);
if (nullptr == m_g.multi) {
DR_LOG(log_error) << "RequestHandler::~RequestHandler - multi handle is null; this should only happen during shutdown";
}
else {
curl_multi_cleanup(m_g.multi);
m_g.multi = nullptr;
}
}
void RequestHandler::threadFunc() {

Expand Down
2 changes: 1 addition & 1 deletion src/request-handler.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/request-router.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/request-router.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 4 additions & 1 deletion src/sip-dialog-controller.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -346,6 +346,9 @@ namespace drachtio {

if( orq ) {
DR_LOG(log_info) << "SipDialogController::doSendRequestInsideDialog - created orq " << std::hex << (void *) orq << " sending " << nta_outgoing_method_name(orq) << " to " << requestUri ;
if( sip_method_invite == method ) {
dlg->addReinviteOrq(orq);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/sip-dialog-controller.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
22 changes: 14 additions & 8 deletions src/sip-dialog.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -199,8 +199,8 @@ namespace drachtio {

nta_leg_t *leg = nta_leg_by_call_id( theOneAndOnlyController->getAgent(), getCallId().c_str() );

DR_LOG(log_debug) << "SipDialog::~SipDialog - I'm holding leg " << std::hex << (void *) m_leg <<
" and retrieved leg via call-id " << (void *) leg;
DR_LOG(log_debug) << "SipDialog::~SipDialog - I'm holding leg " << std::hex << (void *) m_leg <<
" and retrieved leg via call-id " << (void *) leg;

assert( leg ) ;
if( leg ) {
Expand All @@ -214,6 +214,12 @@ namespace drachtio {
if (we_are_uac == m_type && m_orq) {
theOneAndOnlyController->getDialogController()->stopTimerD(m_orq);
}

for (nta_outgoing_t* item : m_reinvites) {
DR_LOG(log_debug) << "SipDialog::~SipDialog - I'm holding a reinvite orq " << std::hex << (void *) item;
theOneAndOnlyController->getDialogController()->stopTimerD(item);
}

/* N.B.: we only destroy the orq here for ACK for non-udp transports, since timer D handles for udp */
if (m_orqAck && m_bDestroyAckOnClose) {
DR_LOG(log_debug) << "SipDialog::~SipDialog - destroying orq from original (uac) ACK " << std::hex << (void *) m_orqAck ;
Expand All @@ -223,11 +229,11 @@ namespace drachtio {
nta_outgoing_destroy(m_orq);
}

auto txnIds = getIncomingRequestTransactionIds();
theOneAndOnlyController->getDialogController()->clearDanglingIncomingRequests(txnIds);
/* if we never got an ACK after sending a 200 OK to an incoming INVITE the net transaction is still there */
theOneAndOnlyController->getClientController()->removeNetTransaction(this->getTransactionId());
auto txnIds = getIncomingRequestTransactionIds();
theOneAndOnlyController->getDialogController()->clearDanglingIncomingRequests(txnIds);

/* if we never got an ACK after sending a 200 OK to an incoming INVITE the net transaction is still there */
theOneAndOnlyController->getClientController()->removeNetTransaction(this->getTransactionId());
}

std::ostream& operator<<(std::ostream& os, const SipDialog& dlg) {
Expand Down
29 changes: 18 additions & 11 deletions src/sip-dialog.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -219,15 +219,19 @@ namespace drachtio {
uint32_t getSeq(void) { return m_seq; }
void clearSeq(void) {m_seq = 0;}

void addIncomingRequestTransaction(std::string& txnId) {
m_incomingRequestTransactionIds.insert(txnId);
}
void removeIncomingRequestTransaction(std::string& txnId) {
m_incomingRequestTransactionIds.erase(txnId);
}
std::vector<std::string> getIncomingRequestTransactionIds(void) {
return std::vector<std::string>(m_incomingRequestTransactionIds.begin(), m_incomingRequestTransactionIds.end());
}
void addIncomingRequestTransaction(std::string& txnId) {
m_incomingRequestTransactionIds.insert(txnId);
}
void removeIncomingRequestTransaction(std::string& txnId) {
m_incomingRequestTransactionIds.erase(txnId);
}
std::vector<std::string> getIncomingRequestTransactionIds(void) {
return std::vector<std::string>(m_incomingRequestTransactionIds.begin(), m_incomingRequestTransactionIds.end());
}

void addReinviteOrq(nta_outgoing_t* orq) {
m_reinvites.push_back(orq);
}

protected:

Expand Down Expand Up @@ -291,7 +295,10 @@ namespace drachtio {
// arrival time
sip_time_t m_tmArrival;

std::set<std::string> m_incomingRequestTransactionIds;
std::set<std::string> m_incomingRequestTransactionIds;

// re-invite orqs that we send as
std::vector<nta_outgoing_t*> m_reinvites;

} ;

Expand Down
2 changes: 1 addition & 1 deletion src/sip-proxy-controller.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/sip-proxy-controller.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/sip-transports.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/sip-transports.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/timer-queue-manager.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/timer-queue.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, David C Horton
Copyright (c) 2024, FirstFive8, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit 92bfc9c

Please sign in to comment.