| 1329 | } |
| 1330 | |
| 1331 | void Stream::Close () |
| 1332 | { |
| 1333 | LogPrint(eLogDebug, "Streaming: closing stream with sSID=", m_SendStreamID, ", rSID=", m_RecvStreamID, ", status=", m_Status); |
| 1334 | switch (m_Status) |
| 1335 | { |
| 1336 | case eStreamStatusOpen: |
| 1337 | m_Status = eStreamStatusClosing; |
| 1338 | Close (); // recursion |
| 1339 | if (m_Status == eStreamStatusClosing) //still closing |
| 1340 | LogPrint (eLogDebug, "Streaming: Trying to send stream data before closing, sSID=", m_SendStreamID); |
| 1341 | break; |
| 1342 | case eStreamStatusReset: |
| 1343 | // TODO: send reset |
| 1344 | Terminate (); |
| 1345 | break; |
| 1346 | case eStreamStatusClosing: |
| 1347 | if (m_SentPackets.empty () && m_SendBuffer.IsEmpty ()) // nothing to send |
| 1348 | { |
| 1349 | m_Status = eStreamStatusClosed; |
| 1350 | SendClose(); |
| 1351 | } |
| 1352 | break; |
| 1353 | case eStreamStatusClosed: |
| 1354 | case eStreamStatusNew: |
| 1355 | // already closed |
| 1356 | Terminate (); |
| 1357 | break; |
| 1358 | default: |
| 1359 | LogPrint (eLogWarning, "Streaming: Unexpected stream status=", (int)m_Status, " for sSID=", m_SendStreamID); |
| 1360 | }; |
| 1361 | } |
| 1362 | |
| 1363 | void Stream::SendClose () |
| 1364 | { |
no test coverage detected