On 6/21/2013 3:29 PM, Edward Berner wrote:
I think I figured out part of the problem.
Way down in http_socket.c, there is no error handling in
socket_receive() and socket_send().
In socket_receive(), I'm seeing a -1 return from recv(), and
WSAGetLastError() returns 10055 which is WSAENOBUFS. According to the
MSDN Library that means "No buffer space available. An operation on a
socket could not be performed because the system lacked sufficient
buffer space or because a queue was full."
(I don't know yet what the WSAENOBUFS is about or how to avoid or
handle it....)
I think recv() was biting off more than it could chew.
Here is the workaround:
Index: src/http_socket.c
==================================================================
--- src/http_socket.c
+++ src/http_socket.c
@@ -200,13 +200,13 @@
*/
size_t socket_receive(void *NotUsed, void *pContent, size_t N){
ssize_t got;
size_t total = 0;
while( N>0 ){
- got = recv(iSocket, pContent, N, 0);
+ got = recv(iSocket, pContent, N>200000 ? 200000 : N, 0);
if( got<=0 ) break;
total += (size_t)got;
N -= (size_t)got;
pContent = (void*)&((char*)pContent)[got];
}
return total;
}
I say "workaround" instead of "fix" because I've only tested it on two
platforms (Windows 2000 and Windows XP SP3) and because that arbitrary
magic number looks kinda ugly.
--
Edward Berner
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users