use blocking sockets by default.

git-svn-id: svn://kolibrios.org@3704 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-06-25 20:02:56 +00:00
parent c9f7535c89
commit 97c13d77de
16 changed files with 158 additions and 291 deletions

View File

@ -302,7 +302,7 @@ SOCKET_open:
; push edx ; push edx
; and edx, SO_NONBLOCK ; and edx, SO_NONBLOCK
or [eax + SOCKET.options], SO_NONBLOCK ;edx ; HACK: make all sockets non-blocking untill API and applications are fixed ; or [eax + SOCKET.options], SO_NONBLOCK ;edx ; HACK: make all sockets non-blocking untill API and applications are fixed
; pop edx ; pop edx
; and edx, not SO_NONBLOCK ; and edx, not SO_NONBLOCK
@ -611,7 +611,7 @@ align 4
jz .loop jz .loop
mov dword[esp+20], EWOULDBLOCK mov dword[esp+20], EWOULDBLOCK
mov dword[esp+32], 0 ; Should be -1? or not? mov dword[esp+32], -1
ret ret
.loop: .loop:
@ -860,32 +860,50 @@ SOCKET_receive:
call SOCKET_num_to_ptr call SOCKET_num_to_ptr
jz .invalid jz .invalid
.loop:
push edi
call [eax + SOCKET.rcv_proc] call [eax + SOCKET.rcv_proc]
pop edi
cmp ebx, EWOULDBLOCK
jne .return
test edi, MSG_DONTWAIT
jnz .return_err
; test [eax + SOCKET.options], SO_NONBLOCK
; jnz .return_err
call SOCKET_block
jmp .loop
.invalid:
push EINVAL
pop ebx
.return_err:
mov eax, -1
.return:
mov [esp+20], ebx mov [esp+20], ebx
mov [esp+32], eax mov [esp+32], eax
ret ret
.invalid:
mov dword[esp+20], EINVAL
mov dword[esp+32], -1
ret
align 4 align 4
SOCKET_receive_dgram: SOCKET_receive_dgram:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: DGRAM\n" DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: DGRAM\n"
mov ebx, esi mov ebx, esi ; bufferlength
mov edi, edx ; addr to buffer
.loop:
get_from_queue (eax + SOCKET_QUEUE_LOCATION), SOCKET_QUEUE_SIZE, sizeof.socket_queue_entry, .block ; destroys esi and ecx
get_from_queue (eax + SOCKET_QUEUE_LOCATION), SOCKET_QUEUE_SIZE, sizeof.socket_queue_entry, .wouldblock ; sets esi only on success.
mov ecx, [esi + socket_queue_entry.data_size] mov ecx, [esi + socket_queue_entry.data_size]
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: %u bytes data\n", ecx DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: %u bytes data\n", ecx
cmp ecx, ebx cmp ecx, ebx ; If data segment does not fit in applications buffer, abort
ja .too_small ja .too_small
push ecx push ecx
@ -893,7 +911,8 @@ SOCKET_receive_dgram:
mov esi, [esi + socket_queue_entry.data_ptr] mov esi, [esi + socket_queue_entry.data_ptr]
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: Source buffer=%x real addr=%x\n", [esp], esi DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: Source buffer=%x real addr=%x\n", [esp], esi
; copy the data ; copy the data from kernel buffer to application buffer
mov edi, edx ; bufferaddr
shr ecx, 1 shr ecx, 1
jnc .nb jnc .nb
movsb movsb
@ -907,28 +926,24 @@ SOCKET_receive_dgram:
rep movsd rep movsd
.nd: .nd:
call kernel_free ; remove the packet call kernel_free ; free kernel buffer
pop eax pop eax ; return number of bytes copied to application
xor ebx, ebx
ret ret
.too_small: .too_small:
mov eax, -1 mov eax, -1
mov ebx, EMSGSIZE push EMSGSIZE
pop ebx
ret ret
.block:
test [eax + SOCKET.options], SO_NONBLOCK
jnz .wouldblock
call SOCKET_block
jmp .loop
.wouldblock: .wouldblock:
mov eax, -1 push EWOULDBLOCK
mov ebx, EWOULDBLOCK pop ebx
ret ret
align 4 align 4
SOCKET_receive_local: SOCKET_receive_local:
@ -940,66 +955,46 @@ SOCKET_receive_local:
mov ebx, [TASK_BASE] mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid] mov ebx, [ebx + TASKDATA.pid]
mov [eax + SOCKET.PID], ebx mov [eax + SOCKET.PID], ebx
mov [eax + SOCKET.TID], ebx ; currently TID = PID in kolibrios :( mov [eax + SOCKET.TID], ebx ; currently TID = PID in kolibrios :(
@@: @@:
mov [eax + SOCKET.rcv_proc], SOCKET_receive_stream mov [eax + SOCKET.rcv_proc], SOCKET_receive_stream
; ... continue to SOCKET_receive_stream
align 4 align 4
SOCKET_receive_stream: SOCKET_receive_stream:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: STREAM\n" DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: STREAM\n"
mov ebx, edi cmp [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0
je .wouldblock
test edi, MSG_PEEK
jnz .peek
mov ecx, esi mov ecx, esi
mov edi, edx mov edi, edx
xor edx, edx xor edx, edx
test ebx, MSG_DONTWAIT
jnz .dontwait
.loop:
cmp [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0
je .block
.dontwait:
test ebx, MSG_PEEK
jnz .peek
add eax, STREAM_SOCKET.rcv add eax, STREAM_SOCKET.rcv
call SOCKET_ring_read call SOCKET_ring_read ; copy data from kernel buffer to application buffer
call SOCKET_ring_free call SOCKET_ring_free ; free read memory
mov eax, ecx ; return number of bytes copied mov eax, ecx ; return number of bytes copied
xor ebx, ebx ; errorcode = 0 (no error)
ret
.wouldblock:
push EWOULDBLOCK
pop ebx
ret ret
.peek: .peek:
mov eax, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size] mov eax, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size]
xor ebx, ebx
ret ret
.block:
test [eax + SOCKET.options], SO_NONBLOCK
jnz .wouldblock
call SOCKET_block
jmp .loop
.return0:
test [eax + SOCKET.options], SS_CANTRCVMORE
jz .ok
xor eax, eax
dec eax
ret
.ok:
xor eax, eax
ret
.wouldblock:
mov eax, -1
mov ebx, EWOULDBLOCK
ret
;----------------------------------------------------------------- ;-----------------------------------------------------------------
; ;
@ -1251,9 +1246,6 @@ SOCKET_set_opt:
cmp dword [edx+4], SO_BINDTODEVICE cmp dword [edx+4], SO_BINDTODEVICE
je .bind je .bind
cmp dword [edx+4], SO_BLOCK
je .block
.invalid: .invalid:
mov dword[esp+32], -1 mov dword[esp+32], -1
mov dword[esp+20], EINVAL mov dword[esp+20], EINVAL
@ -1283,21 +1275,6 @@ SOCKET_set_opt:
mov dword[esp+32], 0 ; success! mov dword[esp+32], 0 ; success!
ret ret
.block:
cmp dword[edx+8], 0
je .unblock
and [eax + SOCKET.options], not SO_NONBLOCK
mov dword[esp+32], 0 ; success!
ret
.unblock:
or [eax + SOCKET.options], SO_NONBLOCK
mov dword[esp+32], 0 ; success!
ret
.already: .already:
mov dword[esp+20], EALREADY mov dword[esp+20], EALREADY
mov dword[esp+32], -1 mov dword[esp+32], -1
@ -1886,8 +1863,8 @@ SOCKET_notify:
test [eax + SOCKET.state], SS_BLOCKED test [eax + SOCKET.state], SS_BLOCKED
jnz .unblock jnz .unblock
test [eax + SOCKET.options], SO_NONBLOCK ; test [eax + SOCKET.options], SO_NONBLOCK
jz .error ; jz .error
push eax ecx esi push eax ecx esi

View File

@ -81,7 +81,6 @@ SO_REUSEPORT = 1 shl 7
SO_USELOOPBACK = 1 shl 8 SO_USELOOPBACK = 1 shl 8
SO_BINDTODEVICE = 1 shl 9 SO_BINDTODEVICE = 1 shl 9
SO_BLOCK = 1 shl 10 ; TO BE REMOVED
SO_NONBLOCK = 1 shl 31 SO_NONBLOCK = 1 shl 31
; Socket flags for user calls ; Socket flags for user calls

View File

@ -7,7 +7,7 @@ include '../../../proc32.inc'
include '../../../macros.inc' include '../../../macros.inc'
purge section,mov,add,sub purge section,mov,add,sub
include 'network.inc' include '../../../network.inc'
section '.flat' code readable align 16 section '.flat' code readable align 16
@ -761,7 +761,7 @@ end virtual
; 2. Read UDP datagram. ; 2. Read UDP datagram.
mov ecx, [edi+__gai_reqdata.socketnum] mov ecx, [edi+__gai_reqdata.socketnum]
push edi push edi
mcall 75, 7, , , 512, 0 mcall 75, 7, , , 512, MSG_DONTWAIT
pop edi pop edi
; 3. Ignore events for other socketnums (return if no data read) ; 3. Ignore events for other socketnums (return if no data read)
test eax, eax test eax, eax

View File

@ -1,94 +0,0 @@
; Socket types
SOCK_STREAM = 1
SOCK_DGRAM = 2
SOCK_RAW = 3
; Socket options
SO_NONBLOCK = 1 shl 31
; IP protocols
IPPROTO_IP = 0
IPPROTO_ICMP = 1
IPPROTO_TCP = 6
IPPROTO_UDP = 17
; Address families
AF_UNSPEC = 0
AF_LOCAL = 1
AF_INET4 = 2 ; IPv4
AF_INET6 = 28 ; IPv6 (not supported yet)
PF_UNSPEC = AF_UNSPEC
PF_LOCAL = AF_LOCAL
PF_INET4 = AF_INET4
PF_INET6 = AF_INET6
; Flags for addrinfo
AI_PASSIVE = 1
AI_CANONNAME = 2
AI_NUMERICHOST = 4
AI_NUMERICSERV = 8
AI_ADDRCONFIG = 0x400
; internal definition
AI_SUPPORTED = 0x40F
; for system function 76
API_ETH = 0 shl 16
API_IPv4 = 1 shl 16
API_ICMP = 2 shl 16
API_UDP = 3 shl 16
API_TCP = 4 shl 16
API_ARP = 5 shl 16
API_PPPOE = 6 shl 16
struct sockaddr_in
sin_family dw ? ; sa_family_t
sin_port dw ? ; in_port_t
sin_addr dd ? ; struct in_addr
sin_zero rb 8 ; zero
ends
struct addrinfo
ai_flags dd ? ; bitmask of AI_*
ai_family dd ? ; PF_*
ai_socktype dd ? ; SOCK_*
ai_protocol dd ? ; 0 or IPPROTO_*
ai_addrlen dd ? ; length of ai_addr
ai_canonname dd ? ; char*
ai_addr dd ? ; struct sockaddr*
ai_next dd ? ; struct addrinfo*
ends
EAI_ADDRFAMILY = 1
EAI_AGAIN = 2
EAI_BADFLAGS = 3
EAI_FAIL = 4
EAI_FAMILY = 5
EAI_MEMORY = 6
EAI_NONAME = 8
EAI_SERVICE = 9
EAI_SOCKTYPE = 10
EAI_BADHINTS = 12
EAI_PROTOCOL = 13
EAI_OVERFLOW = 14
socket fix 75, 0
close fix 75, 1
bind fix 75, 2
listen fix 75, 3
connect fix 75, 4
accept fix 75, 5
send fix 75, 6
recv fix 75, 7
setsockopt fix 75, 8
getsockopt fix 75, 9
socketpair fix 75, 10
struct ARP_entry
IP dd ?
MAC dp ?
status dw ?
TTL dw ?
ends

View File

@ -1,94 +1,98 @@
; Socket types ; Socket types
SOCK_STREAM = 1 SOCK_STREAM = 1
SOCK_DGRAM = 2 SOCK_DGRAM = 2
SOCK_RAW = 3 SOCK_RAW = 3
; Socket options ; Socket options
SO_NONBLOCK = 1 shl 31 SO_NONBLOCK = 1 shl 31
; IP protocols ; IP protocols
IPPROTO_IP = 0 IPPROTO_IP = 0
IPPROTO_ICMP = 1 IPPROTO_ICMP = 1
IPPROTO_TCP = 6 IPPROTO_TCP = 6
IPPROTO_UDP = 17 IPPROTO_UDP = 17
; Address families ; Address families
AF_UNSPEC = 0 AF_UNSPEC = 0
AF_LOCAL = 1 AF_LOCAL = 1
AF_INET4 = 2 ; IPv4 AF_INET4 = 2 ; IPv4
AF_INET6 = 28 ; IPv6 (not supported yet) AF_INET6 = 28 ; IPv6 (not supported yet)
PF_UNSPEC = AF_UNSPEC PF_UNSPEC = AF_UNSPEC
PF_LOCAL = AF_LOCAL PF_LOCAL = AF_LOCAL
PF_INET4 = AF_INET4 PF_INET4 = AF_INET4
PF_INET6 = AF_INET6 PF_INET6 = AF_INET6
; Flags for addrinfo ; Flags for addrinfo
AI_PASSIVE = 1 AI_PASSIVE = 1
AI_CANONNAME = 2 AI_CANONNAME = 2
AI_NUMERICHOST = 4 AI_NUMERICHOST = 4
AI_NUMERICSERV = 8 AI_NUMERICSERV = 8
AI_ADDRCONFIG = 0x400 AI_ADDRCONFIG = 0x400
; internal definition ; internal definition
AI_SUPPORTED = 0x40F AI_SUPPORTED = 0x40F
; for system function 76 ; for system function 76
API_ETH = 0 shl 16 API_ETH = 0 shl 16
API_IPv4 = 1 shl 16 API_IPv4 = 1 shl 16
API_ICMP = 2 shl 16 API_ICMP = 2 shl 16
API_UDP = 3 shl 16 API_UDP = 3 shl 16
API_TCP = 4 shl 16 API_TCP = 4 shl 16
API_ARP = 5 shl 16 API_ARP = 5 shl 16
API_PPPOE = 6 shl 16 API_PPPOE = 6 shl 16
; Socket flags for user calls
MSG_PEEK = 0x02
MSG_DONTWAIT = 0x40
struct sockaddr_in struct sockaddr_in
sin_family dw ? ; sa_family_t sin_family dw ? ; sa_family_t
sin_port dw ? ; in_port_t sin_port dw ? ; in_port_t
sin_addr dd ? ; struct in_addr sin_addr dd ? ; struct in_addr
sin_zero rb 8 ; zero sin_zero rb 8 ; zero
ends ends
struct addrinfo struct addrinfo
ai_flags dd ? ; bitmask of AI_* ai_flags dd ? ; bitmask of AI_*
ai_family dd ? ; PF_* ai_family dd ? ; PF_*
ai_socktype dd ? ; SOCK_* ai_socktype dd ? ; SOCK_*
ai_protocol dd ? ; 0 or IPPROTO_* ai_protocol dd ? ; 0 or IPPROTO_*
ai_addrlen dd ? ; length of ai_addr ai_addrlen dd ? ; length of ai_addr
ai_canonname dd ? ; char* ai_canonname dd ? ; char*
ai_addr dd ? ; struct sockaddr* ai_addr dd ? ; struct sockaddr*
ai_next dd ? ; struct addrinfo* ai_next dd ? ; struct addrinfo*
ends ends
EAI_ADDRFAMILY = 1 EAI_ADDRFAMILY = 1
EAI_AGAIN = 2 EAI_AGAIN = 2
EAI_BADFLAGS = 3 EAI_BADFLAGS = 3
EAI_FAIL = 4 EAI_FAIL = 4
EAI_FAMILY = 5 EAI_FAMILY = 5
EAI_MEMORY = 6 EAI_MEMORY = 6
EAI_NONAME = 8 EAI_NONAME = 8
EAI_SERVICE = 9 EAI_SERVICE = 9
EAI_SOCKTYPE = 10 EAI_SOCKTYPE = 10
EAI_BADHINTS = 12 EAI_BADHINTS = 12
EAI_PROTOCOL = 13 EAI_PROTOCOL = 13
EAI_OVERFLOW = 14 EAI_OVERFLOW = 14
socket fix 75, 0 socket fix 75, 0
close fix 75, 1 close fix 75, 1
bind fix 75, 2 bind fix 75, 2
listen fix 75, 3 listen fix 75, 3
connect fix 75, 4 connect fix 75, 4
accept fix 75, 5 accept fix 75, 5
send fix 75, 6 send fix 75, 6
recv fix 75, 7 recv fix 75, 7
setsockopt fix 75, 8 setsockopt fix 75, 8
getsockopt fix 75, 9 getsockopt fix 75, 9
socketpair fix 75, 10 socketpair fix 75, 10
struct ARP_entry struct ARP_entry
IP dd ? IP dd ?
MAC dp ? MAC dp ?
status dw ? status dw ?
TTL dw ? TTL dw ?
ends ends

View File

@ -187,7 +187,8 @@ mouse:
jmp still jmp still
exit: exit:
or eax, -1 ; close this program DEBUGF 1, "Exiting\n"
or eax, -1 ; close this program
mcall mcall
@ -208,6 +209,10 @@ save:
cmp byte[params], 0 cmp byte[params], 0
jne exit jne exit
mov ecx, [sc.work_text]
or ecx, 0x80000000
mcall 4, <10, 93>, , download_complete
ret ret
save_in_shared: save_in_shared:
@ -249,10 +254,6 @@ save_to_file:
DEBUGF 2, "Saving to file\n" DEBUGF 2, "Saving to file\n"
mcall 70, fileinfo mcall 70, fileinfo
mov ecx, [sc.work_text]
or ecx, 0x80000000
mcall 4, <10, 93>, , download_complete
ret ret
@ -358,15 +359,17 @@ read_incoming_data:
DEBUGF 1, "Reading incoming data\n" DEBUGF 1, "Reading incoming data\n"
mcall 40, EVM_STACK ; we only want stack events now mcall 40, EVM_STACK + EVM_BUTTON
mov eax, [buf_ptr] mov eax, [buf_ptr]
mov [pos], eax mov [pos], eax
.read: .read:
mcall 23, 100 ; 1 second timeout mcall 23, 100 ; 1 second timeout
cmp eax, EV_BUTTON
je exit
.read_dontwait: .read_dontwait:
mcall recv, [socketnum], [pos], BUFFERSIZE, 0 mcall recv, [socketnum], [pos], BUFFERSIZE, MSG_DONTWAIT
inc eax ; -1 = error (socket closed?) inc eax ; -1 = error (socket closed?)
jz .no_more_data jz .no_more_data
dec eax ; 0 bytes... dec eax ; 0 bytes...

View File

@ -161,7 +161,7 @@ wait_for_serverdata:
jnz exit jnz exit
; receive socket data ; receive socket data
mcall recv, [socketnum], [offset], BUFFERSIZE, 0 mcall recv, [socketnum], [offset], BUFFERSIZE, MSG_DONTWAIT
inc eax inc eax
jz wait_for_serverdata jz wait_for_serverdata
dec eax dec eax

View File

@ -80,7 +80,7 @@ pasv_ok:
data_ok: data_ok:
mcall recv, [datasocket], buffer_ptr, BUFFERSIZE, 0 ; fixme: use other buffer mcall recv, [datasocket], buffer_ptr, BUFFERSIZE, MSG_DONTWAIT ; fixme: use other buffer
inc eax inc eax
jz .fail jz .fail
dec eax dec eax

View File

@ -270,7 +270,7 @@ threadloop:
mov ecx, [ebp + thread_data.socketnum] mov ecx, [ebp + thread_data.socketnum]
mov edx, [ebp + thread_data.buffer_ptr] mov edx, [ebp + thread_data.buffer_ptr]
mov esi, sizeof.thread_data.buffer ;;; FIXME mov esi, sizeof.thread_data.buffer ;;; FIXME
xor edi, edi mov edi, MSG_DONTWAIT
mcall recv mcall recv
inc eax ; error? (-1) inc eax ; error? (-1)
jz threadloop jz threadloop

View File

@ -205,11 +205,11 @@ read_incoming_data:
; TODO: read more data if we receive one full packet ; TODO: read more data if we receive one full packet
.nextpacket: .nextpacket:
mcall recv, [socketnum], packetbuf, 1024, 0 ; read a packet mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet
inc eax ; check if we got one inc eax ; check if we got one
jz .done jz .done
dec eax dec eax
jz .done jz .done ; TODO: check for errors!
; ok we have data, now feed it to the recoder ; ok we have data, now feed it to the recoder

View File

@ -286,8 +286,6 @@ exit:
wait_for_data: wait_for_data:
mcall 10 ; wait for data
mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0
cmp eax, -1 cmp eax, -1
je wait_for_data je wait_for_data

View File

@ -91,8 +91,6 @@ start:
mcall send, [socketnum2], hello, hello.length mcall send, [socketnum2], hello, hello.length
.loop: .loop:
mcall 10
mcall recv, [socketnum2], buffer, buffer.length, 0 mcall recv, [socketnum2], buffer, buffer.length, 0
cmp eax, -1 cmp eax, -1
je .loop je .loop

View File

@ -171,25 +171,15 @@ resolve:
mcall 18, 3 mcall 18, 3
mainloop: mainloop:
DEBUGF 1, 'TELNET: Waiting for events\n'
mcall 10
DEBUGF 1, 'TELNET: EVENT %x !\n', eax
call [con_get_flags] call [con_get_flags]
test eax, 0x200 ; con window closed? test eax, 0x200 ; con window closed?
jnz exit jnz exit
.check_for_data:
mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0
cmp eax, -1 cmp eax, -1
jne .parse_data je closed
cmp ebx, 6 ; EWOULDBLOCK
je mainloop
jmp closed
.parse_data:
DEBUGF 1, 'TELNET: got %u bytes of data !\n', eax DEBUGF 1, 'TELNET: got %u bytes of data !\n', eax
mov esi, buffer_ptr mov esi, buffer_ptr
@ -217,7 +207,7 @@ mainloop:
.print: .print:
cmp esi, edi cmp esi, edi
jae .check_for_data jae mainloop
push esi push esi
call [con_write_asciiz] call [con_write_asciiz]

View File

@ -308,7 +308,7 @@ receive_data_loop:
jz .key jz .key
mcall recv, [socketnum], buffer, buffer_len, 0 ; receive data mcall recv, [socketnum], buffer, buffer_len, MSG_DONTWAIT ; receive data
cmp word[buffer], opcode_data cmp word[buffer], opcode_data
jne .error jne .error
@ -415,7 +415,7 @@ send_:
dec eax dec eax
jz .key jz .key
mcall recv, [socketnum], buffer, buffer_len, 0 ; receive ack mcall recv, [socketnum], buffer, buffer_len, MSG_DONTWAIT ; receive ack
cmp word[buffer], opcode_ack cmp word[buffer], opcode_ack
jne .exit jne .exit

View File

@ -3,7 +3,7 @@ thread_start:
DEBUGF 1, 'I am the thread!\n' DEBUGF 1, 'I am the thread!\n'
mcall 40, 1 shl 7 mcall 40, 0
; resolve name ; resolve name
push esp ; reserve stack place push esp ; reserve stack place
@ -55,8 +55,6 @@ no_security:
mcall send, [socketnum], shared, 1, 0 mcall send, [socketnum], shared, 1, 0
DEBUGF 1, 'Sending handshake: shared session?\n' DEBUGF 1, 'Sending handshake: shared session?\n'
mcall 23, 100*TIMEOUT
call wait_for_data ; now the server should send init message call wait_for_data ; now the server should send init message
DEBUGF 1, 'Serverinit: bpp: %u depth: %u bigendian: %u truecolor: %u\n', \ DEBUGF 1, 'Serverinit: bpp: %u depth: %u bigendian: %u truecolor: %u\n', \
@ -85,8 +83,6 @@ request_rfb:
mcall send, [socketnum], fbur, 10, 0 mcall send, [socketnum], fbur, 10, 0
thread_loop: thread_loop:
mcall 23, 100
call read_data ; Read the data into the buffer call read_data ; Read the data into the buffer
; cmp eax, 2 ; cmp eax, 2
@ -206,10 +202,8 @@ servercuttext:
read_data: read_data:
mov [datapointer], receive_buffer mov [datapointer], receive_buffer
.loop: .loop:
mcall 23, 100*TIMEOUT
mcall recv, [socketnum], [datapointer], 4096, 0 mcall recv, [socketnum], [datapointer], 4096, 0
cmp eax, -1 cmp eax, -1
je .done je .done
@ -227,8 +221,6 @@ read_data:
wait_for_data: wait_for_data:
mcall 23, 500
mcall recv, [socketnum], receive_buffer, 4096, 0 mcall recv, [socketnum], receive_buffer, 4096, 0
cmp eax, -1 cmp eax, -1
je wait_for_data je wait_for_data

View File

@ -295,7 +295,7 @@ send_dhcpmsg:
mcall 23, TIMEOUT*100 ; wait for data mcall 23, TIMEOUT*100 ; wait for data
read_data: ; we have data - this will be the response read_data: ; we have data - this will be the response
mcall 75, 7, [socketNum], [dhcpMsg], BUFFER, 0 ; read data from socket mcall 75, 7, [socketNum], [dhcpMsg], BUFFER, MSG_DONTWAIT ; read data from socket
cmp eax, -1 cmp eax, -1
jne @f jne @f
DEBUGF 1,"No answer from DHCP server\n" DEBUGF 1,"No answer from DHCP server\n"