forked from KolibriOS/kolibrios
kernel: wait 3 seconds for TCP connection to be established, timeout after that.
telnet: print error message when socket could not be opened. git-svn-id: svn://kolibrios.org@4020 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
83cca53cfa
commit
7cade993e9
@ -608,22 +608,32 @@ align 4
|
||||
|
||||
.block:
|
||||
test [eax + SOCKET.options], SO_NONBLOCK
|
||||
jz .loop
|
||||
jz .waitforit
|
||||
|
||||
mov dword[esp+20], EWOULDBLOCK
|
||||
mov dword[esp+32], -1
|
||||
ret
|
||||
|
||||
.waitforit:
|
||||
push eax
|
||||
stdcall timer_hs, 300, 0, .wake, eax ; FIXME: make timeout a constant
|
||||
pop eax
|
||||
|
||||
.loop:
|
||||
cmp [eax + TCP_SOCKET.t_state], TCPS_CLOSED
|
||||
je .fail
|
||||
cmp [eax + SOCKET.errorcode], 0
|
||||
jne .fail
|
||||
cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED
|
||||
je .established
|
||||
ja .fail
|
||||
|
||||
call SOCKET_block
|
||||
jmp .loop
|
||||
|
||||
.wake:
|
||||
mov eax, [esp+4]
|
||||
mov [eax + SOCKET.errorcode], ETIMEDOUT
|
||||
call SOCKET_notify.unblock
|
||||
ret 4
|
||||
|
||||
.fail:
|
||||
mov eax, [eax + SOCKET.errorcode]
|
||||
mov [esp+20], eax
|
||||
|
@ -160,6 +160,8 @@ resolve:
|
||||
mov [socketnum], eax
|
||||
|
||||
mcall connect, [socketnum], sockaddr1, 18
|
||||
test eax, eax
|
||||
jnz socket_err
|
||||
|
||||
mcall 40, 1 shl 7 ; + 7
|
||||
call [con_cls]
|
||||
|
Loading…
Reference in New Issue
Block a user