Wayne_
Joined: 10 Oct 2007 Posts: 681
|
http.c in the tcp/ip examples. |
Posted: Thu Dec 02, 2010 4:33 am |
|
|
Just to let you know, if you are using the CCS tcp/ip examples for a web server there is a bug if you try and use more than 1 socket.
The function tcp_http_put_file in http.c has a static var (status) which retains the value for the last socket. When using multiple sockets this can become incorrect for the current one.
An easy fix is to :-
Code: |
static enum
{
HTTP_PUT_FILE_INIT = 0,
HTTP_PUT_FILE_CONTINUE,
HTTP_PUT_FILE_CHUNK_END,
HTTP_PUT_FILE_DONE
} status[HTTP_NUM_SOCKETS];
|
and then change all references to static in the function to
Code: |
status[which] = HTTP_PUT_FILE_CONTINUE;
...
if (status[which] == HTTP_PUT_FILE_CONTINUE)
...
if (ec == TCP_PUT_CONST_EC_FINISH)
status[which] = HTTP_PUT_FILE_CHUNK_END;
...
if (status[which] == HTTP_PUT_FILE_CHUNK_END)
...
status[which] = HTTP_PUT_FILE_DONE;
and
return(status[which] == HTTP_PUT_FILE_DONE);
|
Hope this helps!
I am also implementing some changes to speed it up a bit. Not ready to release those though. |
|