diff --git a/kernel/branches/net/applications/ftpd/ftpd.asm b/kernel/branches/net/applications/ftpd/ftpd.asm index 1e61015f69..3142212565 100644 --- a/kernel/branches/net/applications/ftpd/ftpd.asm +++ b/kernel/branches/net/applications/ftpd/ftpd.asm @@ -144,11 +144,13 @@ start: invoke ini.get_int, path, str_pasv, str_end, 5000 mov [pasv_end], ax + mov [alive], 1 + mainloop: mcall 23, 100 ; Wait here for incoming connections on the base socket (socketnum) - ; One second timeout, we sill use this to check if console is still working + ; One second timeout, we will use this to check if console is still working - test eax, 1 shl 7 ; network event? + test eax, eax ; network event? jz .checkconsole mcall 51, 1, threadstart, 0 ; Start a new thread for every incoming connection @@ -161,6 +163,7 @@ mainloop: test eax, 0x0200 jz mainloop mcall close, [socketnum] ; kill the listening socket + mov [alive], 0 mcall -1 ; and exit diff16 "threadstart", 0, $ @@ -208,6 +211,9 @@ threadloop: cmp eax, -1 je thread_exit + cmp [alive], 0 ; Did main thread take a run for it? + je thread_exit + mcall 10 ; Wait for network event cmp [ebp + thread_data.mode], MODE_PASSIVE_WAIT @@ -405,6 +411,8 @@ diff16 "i_end", 0, $ ini_buf rb 3*4+3+1 + alive db ? + mem: