Commit c33eb8e5 authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

sip: remove dead code in SipTransportBroker

Refs #64903

Change-Id: Ia8986be9c7c4566e6f26e2b9bedaa09b0247a6db
parent c6a9f4a2
......@@ -237,7 +237,6 @@ SipTransportBroker::transportStateChanged(pjsip_transport* tp, pjsip_transport_s
RING_WARN("UDP transport destroy");
transports_.erase(transport_key->second);
udpTransports_.erase(transport_key);
transportDestroyedCv_.notify_all();
}
}
}
......@@ -282,25 +281,6 @@ SipTransportBroker::shutdown()
}
}
void
SipTransportBroker::waitForReleased(const SipTransportDescr& tp, std::function<void(bool)> released_cb)
{
std::vector<std::pair<SipTransportDescr, pjsip_transport*>> to_destroy_all;
bool destroyed = false;
{
std::unique_lock<std::mutex> lock(transportMapMutex_);
auto check_destroyed = [&](){
return udpTransports_.find(tp) == udpTransports_.end();
};
destroyed = transportDestroyedCv_.wait_for(lock, std::chrono::seconds(10), check_destroyed);
if (!destroyed)
destroyed = check_destroyed();
}
if (released_cb)
released_cb(destroyed);
}
std::shared_ptr<SipTransport>
SipTransportBroker::getUdpTransport(const SipTransportDescr& descr)
{
......@@ -459,38 +439,6 @@ SipTransportBroker::getIceTransport(const std::shared_ptr<IceTransport> ice, uns
}
#endif
std::vector<pj_sockaddr>
SipTransportBroker::getSTUNAddresses(const pj_str_t serverName, pj_uint16_t port, std::vector<long> &socketDescriptors) const
{
const size_t ip_num = socketDescriptors.size();
pj_sockaddr_in ipv4[ip_num];
pj_status_t ret = pjstun_get_mapped_addr(&cp_.factory,
socketDescriptors.size(), &socketDescriptors[0],
&serverName, port, &serverName, port, ipv4);
if (ret != PJ_SUCCESS) {
RING_ERR("STUN query to server \"%.*s\" failed", serverName.slen, serverName.ptr);
switch (ret) {
case PJLIB_UTIL_ESTUNNOTRESPOND:
RING_ERR("No response from STUN server(s)");
break;
case PJLIB_UTIL_ESTUNSYMMETRIC:
RING_ERR("Different mapped addresses are returned by servers.");
break;
default:
break;
}
throw std::runtime_error("Can't resolve STUN request");
}
std::vector<pj_sockaddr> result(ip_num);
for(size_t i=0; i<ip_num; i++) {
result[i].ipv4 = ipv4[i];
RING_WARN("STUN PORTS: %ld", pj_sockaddr_get_port(&result[i]));
}
return result;
}
#define RETURN_IF_NULL(A, M, ...) if ((A) == NULL) { RING_ERR(M, ##__VA_ARGS__); return; }
void
......
......@@ -173,11 +173,6 @@ public:
return tp;
}
/**
* This function returns a list of STUN mapped sockets for
* a given set of socket file descriptors */
std::vector<pj_sockaddr> getSTUNAddresses(const pj_str_t serverName, pj_uint16_t port, std::vector<long> &socks) const;
/**
* Get the correct address to use (ie advertised) from
* a uri. The corresponding transport that should be used
......@@ -191,14 +186,6 @@ public:
void findLocalAddressFromSTUN(pjsip_transport *transport, pj_str_t *stunServerName,
int stunPort, std::string &address, pj_uint16_t &port) const;
/**
* Call released_cb(success) when transport tp is destroyed, making the
* socket available for a new similar transport.
* success is true if the transport is actually released.
* TODO: make this call non-blocking.
*/
void waitForReleased(const SipTransportDescr& tp, std::function<void(bool)> released_cb);
/**
* Start gracefull shutdown procedure for all transports
*/
......@@ -226,7 +213,6 @@ private:
*/
std::map<pjsip_transport*, std::weak_ptr<SipTransport>> transports_ {};
std::mutex transportMapMutex_ {};
std::condition_variable transportDestroyedCv_ {};
/**
* Transports are stored in this map in order to retreive them in case
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment