MCPcopy Create free account
hub / github.com/apache/mesos / proxy

Method proxy

3rdparty/libprocess/src/process.cpp:1731–1760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1729
1730
1731PID<HttpProxy> SocketManager::proxy(const Socket& socket)
1732{
1733 HttpProxy* proxy = nullptr;
1734
1735 synchronized (mutex) {
1736 // This socket might have been asked to get closed (e.g., remote
1737 // side hang up) while a process is attempting to handle an HTTP
1738 // request. Thus, if there is no more socket, return an empty PID.
1739 if (sockets.count(socket) > 0) {
1740 if (proxies.count(socket) > 0) {
1741 return proxies[socket]->self();
1742 } else {
1743 proxy = new HttpProxy(sockets.at(socket));
1744 proxies[socket] = proxy;
1745 }
1746 }
1747 }
1748
1749 // Now check if we need to spawn a newly created proxy. Note that we
1750 // need to do this outside of the synchronized block above to avoid
1751 // a possible deadlock (because spawn eventually synchronizes on
1752 // ProcessManager and ProcessManager::cleanup synchronizes on
1753 // ProcessManager and then SocketManager, so a deadlock results if
1754 // we do spawn within the synchronized block above).
1755 if (proxy != nullptr) {
1756 return spawn(proxy, true);
1757 }
1758
1759 return PID<HttpProxy>();
1760}
1761
1762
1763void SocketManager::unproxy(const Socket& socket)

Callers 10

handleMethod · 0.80
foreachFunction · 0.80
kbFunction · 0.80
CarouselFunction · 0.80
bootstrap.jsFile · 0.80
ScrollSpyFunction · 0.80
AffixFunction · 0.80
bFunction · 0.80
bootstrap.min.jsFile · 0.80

Calls 1

spawnFunction · 0.70

Tested by

no test coverage detected