mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-03 11:30:53 +00:00
Allow only one Telnet connection at a time.
As the session state management of Telnet server is a single static variable allowing more than one connection leads to inconsistencies.
This commit is contained in:
parent
831312e311
commit
d862e9dcfb
@ -186,15 +186,14 @@ PROCESS_THREAD(telnetd_process, ev, data)
|
|||||||
{
|
{
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
tcp_listen(UIP_HTONS(23));
|
|
||||||
buf_init(&buf);
|
|
||||||
|
|
||||||
shell_init();
|
shell_init();
|
||||||
|
|
||||||
#if TELNETD_CONF_GUI
|
#if TELNETD_CONF_GUI
|
||||||
telnetd_gui_init();
|
telnetd_gui_init();
|
||||||
#endif /* TELNETD_CONF_GUI */
|
#endif /* TELNETD_CONF_GUI */
|
||||||
|
|
||||||
|
tcp_listen(UIP_HTONS(23));
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT();
|
PROCESS_WAIT_EVENT();
|
||||||
if(ev == tcpip_event) {
|
if(ev == tcpip_event) {
|
||||||
@ -229,11 +228,6 @@ senddata(void)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
closed(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
|
||||||
get_char(u8_t c)
|
get_char(u8_t c)
|
||||||
{
|
{
|
||||||
PRINTF("telnetd: get_char '%c' %d %d\n", c, c, s.bufptr);
|
PRINTF("telnetd: get_char '%c' %d %d\n", c, c, s.bufptr);
|
||||||
@ -347,6 +341,7 @@ void
|
|||||||
telnetd_appcall(void *ts)
|
telnetd_appcall(void *ts)
|
||||||
{
|
{
|
||||||
if(uip_connected()) {
|
if(uip_connected()) {
|
||||||
|
tcp_unlisten(UIP_HTONS(23));
|
||||||
tcp_markconn(uip_conn, &s);
|
tcp_markconn(uip_conn, &s);
|
||||||
buf_init(&buf);
|
buf_init(&buf);
|
||||||
s.bufptr = 0;
|
s.bufptr = 0;
|
||||||
@ -363,7 +358,7 @@ telnetd_appcall(void *ts)
|
|||||||
uip_aborted() ||
|
uip_aborted() ||
|
||||||
uip_timedout()) {
|
uip_timedout()) {
|
||||||
shell_stop();
|
shell_stop();
|
||||||
closed();
|
tcp_listen(UIP_HTONS(23));
|
||||||
}
|
}
|
||||||
if(uip_acked()) {
|
if(uip_acked()) {
|
||||||
acked();
|
acked();
|
||||||
|
Loading…
Reference in New Issue
Block a user