This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
http_client and command history fixies
- From: Jani Monoses <jani at iv dot ro>
- To: ecos-patches at sources dot redhat dot com
- Date: Fri, 16 Aug 2002 19:39:55 +0000
- Subject: http_client and command history fixies
a) Here, when trying to fetch small files through http the server closes the connection
quickly enough so state is _CLOSED but if rxcnt > 0 (data not yet read) it is all lost.
So put some 'else' s and we don't reach 'return -1' in that case.
b) I think empty lines in command history are useless.
Index: redboot/current//ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.69
diff -u -r1.69 ChangeLog
--- redboot/current//ChangeLog 12 Aug 2002 07:54:52 -0000 1.69
+++ redboot/current//ChangeLog 16 Aug 2002 16:28:46 -0000
@@ -1,3 +1,10 @@
+2002-08-16 Jani Monoses <jani@iv.ro>
+
+ * src/io.c: Do not add empty lines to command history.
+ * src/net/http_client.c: Read all data when in CLOSE_WAIT
+ otherwise if the server closes quickly enough nothing is
+ received.
+
2002-08-09 Andrew Lunn <andrew.lunn@ascom.ch>
* src/crc.c: Removed. Replaced with the CRC package.
Index: redboot/current//src/io.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/io.c,v
retrieving revision 1.27
diff -u -r1.27 io.c
--- redboot/current//src/io.c 6 Aug 2002 14:29:12 -0000 1.27
+++ redboot/current//src/io.c 16 Aug 2002 16:28:49 -0000
@@ -490,7 +490,7 @@
}
last_ch = c;
#if CYGNUM_REDBOOT_CMD_LINE_EDITING != 0
- if (cmd_history) {
+ if (cmd_history && (buf != eol)) {
// Save current line - only when enabled
if (++_cl_index == _CL_NUM_LINES) _cl_index = 0;
if (_cl_index > _cl_max_index) _cl_max_index = _cl_index;
Index: redboot/current//src/net/http_client.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/net/http_client.c,v
retrieving revision 1.4
diff -u -r1.4 http_client.c
--- redboot/current//src/net/http_client.c 9 Aug 2002 13:20:34 -0000 1.4
+++ redboot/current//src/net/http_client.c 16 Aug 2002 16:28:50 -0000
@@ -131,16 +131,15 @@
if (s->sock.data_bytes == 0 && s->sock.rxcnt == 0) {
__tcp_close(&s->sock);
return total;
- }
- }
- if (s->sock.state == _CLOSED) {
- // The connection is gone
- s->open = false;
-
+ }
+ } else if (s->sock.state == _CLOSED) {
+ // The connection is gone
+ s->open = false;
+ return -1;
+ } else {
+ *err = HTTP_IO;
return -1;
- }
- *err = HTTP_IO;
- return -1;
+ }
}
s->actual_len = __tcp_read(&s->sock, s->data, sizeof(s->data));
if (s->actual_len > 0) {