| 788 | } |
| 789 | |
| 790 | void BpManager::TrySendData() |
| 791 | { |
| 792 | CircularBuffer::View outView; |
| 793 | |
| 794 | while (true) |
| 795 | { |
| 796 | int sizeLeft = mOutBuffer.GetSize(); |
| 797 | if (sizeLeft == 0) |
| 798 | return; |
| 799 | |
| 800 | int trySend = std::min(sizeLeft, 8192); |
| 801 | mOutBuffer.MapView(0, trySend, outView); |
| 802 | |
| 803 | int result = send(mSocket, (const char*)outView.mPtr, trySend, 0); |
| 804 | |
| 805 | if (result < 0) |
| 806 | { |
| 807 | #ifdef BF_PLATFORM_WINDOWS |
| 808 | int err = WSAGetLastError(); |
| 809 | switch (err) |
| 810 | { |
| 811 | case WSAECONNABORTED: |
| 812 | case WSAECONNRESET: |
| 813 | mConnectState = BpConnectState_NotConnected; |
| 814 | } |
| 815 | #else |
| 816 | switch (errno) |
| 817 | { |
| 818 | case ECONNRESET: |
| 819 | mConnectState = BpConnectState_NotConnected; |
| 820 | } |
| 821 | #endif |
| 822 | return; |
| 823 | } |
| 824 | |
| 825 | mOutBuffer.RemoveFront(result); |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | void BpManager::LostConnection() |
| 830 | { |
nothing calls this directly
no test coverage detected