From c9f7535c8946f1292088dba2b5175b58b6417167 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Tue, 25 Jun 2013 16:31:10 +0000 Subject: [PATCH] Bugix for telnet receive function. git-svn-id: svn://kolibrios.org@3703 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/network/telnet/telnet.asm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/programs/network/telnet/telnet.asm b/programs/network/telnet/telnet.asm index 1def406b7e..74cbe0884b 100644 --- a/programs/network/telnet/telnet.asm +++ b/programs/network/telnet/telnet.asm @@ -179,9 +179,16 @@ mainloop: test eax, 0x200 ; con window closed? jnz exit + .check_for_data: mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 cmp eax, -1 + jne .parse_data + cmp ebx, 6 ; EWOULDBLOCK je mainloop + jmp closed + + + .parse_data: DEBUGF 1, 'TELNET: got %u bytes of data !\n', eax @@ -210,7 +217,7 @@ mainloop: .print: cmp esi, edi - jae mainloop + jae .check_for_data push esi call [con_write_asciiz] @@ -241,6 +248,11 @@ hostname_error: call [con_write_asciiz] jmp prompt +closed: + push str12 + call [con_write_asciiz] + jmp prompt + done: push 1 call [con_exit] @@ -276,6 +288,7 @@ str9 db ')',10,0 str5 db 'Name resolution failed.',10,10,0 str6 db 'Could not open socket.',10,10,0 str11 db 'Invalid hostname.',10,10,0 +str12 db 10,'Remote host closed the connection.',10,10,0 sockaddr1: dw AF_INET4