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:
|
.block:
|
||||||
test [eax + SOCKET.options], SO_NONBLOCK
|
test [eax + SOCKET.options], SO_NONBLOCK
|
||||||
jz .loop
|
jz .waitforit
|
||||||
|
|
||||||
mov dword[esp+20], EWOULDBLOCK
|
mov dword[esp+20], EWOULDBLOCK
|
||||||
mov dword[esp+32], -1
|
mov dword[esp+32], -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.waitforit:
|
||||||
|
push eax
|
||||||
|
stdcall timer_hs, 300, 0, .wake, eax ; FIXME: make timeout a constant
|
||||||
|
pop eax
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
cmp [eax + TCP_SOCKET.t_state], TCPS_CLOSED
|
cmp [eax + SOCKET.errorcode], 0
|
||||||
je .fail
|
jne .fail
|
||||||
cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED
|
cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED
|
||||||
je .established
|
je .established
|
||||||
ja .fail
|
|
||||||
|
|
||||||
call SOCKET_block
|
call SOCKET_block
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
|
||||||
|
.wake:
|
||||||
|
mov eax, [esp+4]
|
||||||
|
mov [eax + SOCKET.errorcode], ETIMEDOUT
|
||||||
|
call SOCKET_notify.unblock
|
||||||
|
ret 4
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
mov eax, [eax + SOCKET.errorcode]
|
mov eax, [eax + SOCKET.errorcode]
|
||||||
mov [esp+20], eax
|
mov [esp+20], eax
|
||||||
|
@ -160,6 +160,8 @@ resolve:
|
|||||||
mov [socketnum], eax
|
mov [socketnum], eax
|
||||||
|
|
||||||
mcall connect, [socketnum], sockaddr1, 18
|
mcall connect, [socketnum], sockaddr1, 18
|
||||||
|
test eax, eax
|
||||||
|
jnz socket_err
|
||||||
|
|
||||||
mcall 40, 1 shl 7 ; + 7
|
mcall 40, 1 shl 7 ; + 7
|
||||||
call [con_cls]
|
call [con_cls]
|
||||||
|
Loading…
Reference in New Issue
Block a user