MCPcopy Create free account
hub / github.com/apache/brpc / DestroyStreamUserData

Method DestroyStreamUserData

src/brpc/rtmp.cpp:1761–1782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1759}
1760
1761void RtmpClientStream::DestroyStreamUserData(SocketUniquePtr& sending_sock,
1762 Controller* cntl,
1763 int /*error_code*/,
1764 bool end_of_rpc) {
1765 if (!end_of_rpc) {
1766 if (sending_sock) {
1767 if (_from_socketmap) {
1768 _client_impl->socket_map().Remove(SocketMapKey(sending_sock->remote_side()),
1769 sending_sock->id());
1770 } else {
1771 sending_sock->SetFailed(); // not necessary, already failed.
1772 }
1773 }
1774 } else {
1775 // Always move sending_sock into _rtmpsock at the end of rpc.
1776 // - If the RPC is successful, moving sending_sock prevents it from
1777 // setfailed in Controller after calling this method.
1778 // - If the RPC is failed, OnStopInternal() can clean up the socket_map
1779 // inserted in OnCreatingStream().
1780 _rtmpsock.swap(sending_sock);
1781 }
1782}
1783
1784
1785void RtmpClientStream::DestroyStreamCreator(Controller* cntl) {

Callers 2

TEST_FFunction · 0.45
OnCompleteMethod · 0.45

Calls 6

SocketMapKeyClass · 0.85
RemoveMethod · 0.45
remote_sideMethod · 0.45
idMethod · 0.45
SetFailedMethod · 0.45
swapMethod · 0.45

Tested by 1

TEST_FFunction · 0.36