MCPcopy Create free account
hub / github.com/beefytech/Beef / TrySendData

Method TrySendData

BeefySysLib/util/BeefPerf.cpp:790–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790void 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
829void BpManager::LostConnection()
830{

Callers

nothing calls this directly

Calls 3

MapViewMethod · 0.80
RemoveFrontMethod · 0.80
GetSizeMethod · 0.45

Tested by

no test coverage detected