fix TCP client request buffer parsing

pull/39/head
Thorsten von Eicken 9 years ago
parent 71bc355038
commit 29100391b1
  1. 7
      serial/tcpclient.c
  2. 3
      user/status.c

@ -261,10 +261,15 @@ tcpClientCommand(uint8_t chan, char cmd, char *cmdBuf) {
char *hostname;
char *port;
// copy the command so we can modify it
char buf[128];
os_strncpy(buf, cmdBuf, 128);
buf[127] = 0;
switch (cmd) {
//== TCP Connect command
case 'T':
hostname = cmdBuf;
hostname = buf;
port = hostname;
while (*port != 0 && *port != ':') port++;
if (*port != ':') break;

@ -81,6 +81,7 @@ static void ICACHE_FLASH_ATTR rssiTimerCb(void *v) {
return;
sint8 rssi = wifi_station_get_rssi();
os_printf("timer rssi=%d\n", rssi);
if (rssi >= 0) return; // not connected or other error
// compose TCP command
@ -100,7 +101,7 @@ static void ICACHE_FLASH_ATTR rssiTimerCb(void *v) {
"[{\"compId\":\"%s\", \"streamId\":\"%s\", \"data\":%d}]\r",
flashConfig.hostname, GS_STREAM, rssi);
buf[hdrLen+dataLen++] = 0;
buf[hdrLen+dataLen++] = '\r';
buf[hdrLen+dataLen++] = '\n';
// hackish way to fill in the content-length
os_sprintf(buf+hdrLen-9, "%5d", dataLen);

Loading…
Cancel
Save