| 1759 | } |
| 1760 | |
| 1761 | void 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 | |
| 1785 | void RtmpClientStream::DestroyStreamCreator(Controller* cntl) { |