@@ -155,6 +155,9 @@ bool CModuleHelp_SrtCore::ModuleHelp_SrtCore_Send(LPCXSTR lpszClientAddr, LPCXST
155155 bFound = true ;
156156 break ;
157157 }
158+ else
159+ {
160+ }
158161 }
159162 if (!bFound)
160163 {
@@ -165,23 +168,41 @@ bool CModuleHelp_SrtCore::ModuleHelp_SrtCore_Send(LPCXSTR lpszClientAddr, LPCXST
165168 }
166169 // int nSRTEvent = SRT_EPOLL_OUT | SRT_EPOLL_ERR;
167170 // srt_epoll_add_usock(hSRTEPoll, hSRTSocket, &nSRTEvent);
171+
172+ int nRet = 0 ;
173+ int nSendCount = 0 ;
174+ int nLeftCount = nMsgLen;
168175 SRTSOCKET hSocket = stl_MapIterator->second .hSocket ;
169- st_Locker. unlock_shared ();
176+
170177 while (true )
171178 {
172- int nRet = srt_sendmsg (hSocket, lpszMsgBuffer, nMsgLen, -1 , 1 );
173- if (nRet >= 0 )
179+ if (nLeftCount > 1300 )
180+ {
181+ nRet = srt_send (hSocket, lpszMsgBuffer + nSendCount, 1300 );
182+ nSendCount += 1300 ;
183+ nLeftCount -= 1300 ;
184+ }
185+ else
186+ {
187+ nRet = srt_send (hSocket, lpszMsgBuffer + nSendCount, nLeftCount);
188+ nSendCount += nLeftCount;
189+ nLeftCount -= nLeftCount;
190+ }
191+
192+ if (nSendCount == nMsgLen)
174193 {
175194 break ;
176195 }
177- nRet = srt_getlasterror ( NULL );
178- if (SRT_EASYNCSND ! = nRet)
196+
197+ if (- 1 = = nRet)
179198 {
180199 ModuleHelp_IsErrorOccur = true ;
181- ModuleHelp_dwErrorCode = ERROR_MODULE_HELP_SRT_NOTFOUND;
200+ ModuleHelp_dwErrorCode = ERROR_MODULE_HELP_SRT_SENDFAILED;
201+ st_Locker.unlock_shared ();
182202 return false ;
183203 }
184204 }
205+ st_Locker.unlock_shared ();
185206 // nSRTEvent = SRT_EPOLL_IN | SRT_EPOLL_ERR;
186207 // srt_epoll_update_usock(hSRTEPoll, hSRTSocket, &nSRTEvent);
187208
0 commit comments