You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/02/04 22:07:42 UTC
[incubator-nuttx-apps] 03/06: Don't return 1 in _environ_telnet to
avoid trigger the compression
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch pr50
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit 5f83bb768580b3cf3d5af0b21c029fd8c785c703
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Feb 4 16:30:45 2020 +0800
Don't return 1 in _environ_telnet to avoid trigger the compression
and remove the redundant TELNET_TELOPT_COMPRESS2 check
Change-Id: I082bc3417fc8d76dafd1f92afd0e2d036daac82d
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
netutils/telnetc/telnetc.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/netutils/telnetc/telnetc.c b/netutils/telnetc/telnetc.c
index e2fac4a..09475f1 100644
--- a/netutils/telnetc/telnetc.c
+++ b/netutils/telnetc/telnetc.c
@@ -713,7 +713,7 @@ static int _environ_telnet(struct telnet_s *telnet, unsigned char type,
ev.type = TELNET_EV_ENVIRON;
telnet->eh(telnet, &ev, telnet->ud);
- return 1;
+ return 0;
}
/* Every second byte must be VAR or USERVAR, if present */
@@ -854,7 +854,7 @@ static int _environ_telnet(struct telnet_s *telnet, unsigned char type,
/* Clean up */
free(values);
- return 1;
+ return 0;
}
/* Process an MSSP subnegotiation buffer */
@@ -1104,21 +1104,17 @@ static int _subnegotiate(struct telnet_s *telnet)
*/
case TELNET_TELOPT_COMPRESS2:
- if (telnet->sb_telopt == TELNET_TELOPT_COMPRESS2)
+ if (_init_zlib(telnet, 0, 1) != TELNET_EOK)
{
- if (_init_zlib(telnet, 0, 1) != TELNET_EOK)
- {
- return 0;
- }
+ return 0;
+ }
- /* Notify app that compression was enabled */
+ /* Notify app that compression was enabled */
- ev.type = TELNET_EV_COMPRESS;
- ev.compress.state = 1;
- telnet->eh(telnet, &ev, telnet->ud);
- return 1;
- }
- return 0;
+ ev.type = TELNET_EV_COMPRESS;
+ ev.compress.state = 1;
+ telnet->eh(telnet, &ev, telnet->ud);
+ return 1;
#endif /* HAVE_ZLIB */
/* Specially handled subnegotiation telopt types */