| 59 | } |
| 60 | |
| 61 | void ODSocketClient::disconnect(bool keepReplay) |
| 62 | { |
| 63 | mPendingTimestamp = -1; |
| 64 | ODSource src = mSource; |
| 65 | mSource = ODSource::none; |
| 66 | switch(src) |
| 67 | { |
| 68 | case ODSource::none: |
| 69 | { |
| 70 | // Nothing to do |
| 71 | return; |
| 72 | } |
| 73 | case ODSource::network: |
| 74 | { |
| 75 | // Remove any remaining client sockets from the socket selector, |
| 76 | // if there is any left. |
| 77 | mSockSelector.clear(); |
| 78 | mSockClient.disconnect(); |
| 79 | break; |
| 80 | } |
| 81 | case ODSource::file: |
| 82 | { |
| 83 | mReplayInputStream.close(); |
| 84 | return; |
| 85 | } |
| 86 | default: |
| 87 | assert(false); |
| 88 | break; |
| 89 | } |
| 90 | |
| 91 | mReplayOutputStream.close(); |
| 92 | // Delete the replay newly created if asked to. |
| 93 | if (!keepReplay) |
| 94 | boost::filesystem::remove(mOutputReplayFilename); |
| 95 | mOutputReplayFilename.clear(); |
| 96 | } |
| 97 | |
| 98 | bool ODSocketClient::isDataAvailable() |
| 99 | { |