forked from KolibriOS/kolibrios
More descriptive constant names, reduced socket buffer size.
git-svn-id: svn://kolibrios.org@6413 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
9bafc8aa7b
commit
6c4e2f8033
@ -187,11 +187,11 @@ struct socket_options
|
|||||||
|
|
||||||
ends
|
ends
|
||||||
|
|
||||||
SOCKETBUFFSIZE = 4096 ; in bytes
|
SOCKET_STRUCT_SIZE = 4096 ; in bytes
|
||||||
|
|
||||||
SOCKET_QUEUE_SIZE = 10 ; maximum number of incoming packets queued for 1 socket
|
SOCKET_QUEUE_SIZE = 10 ; maximum number of incoming packets queued for 1 socket
|
||||||
; the incoming packet queue for sockets is placed in the socket struct itself, at this location from start
|
; the incoming packet queue for sockets is placed in the socket struct itself, at this location from start
|
||||||
SOCKET_QUEUE_LOCATION = (SOCKETBUFFSIZE - SOCKET_QUEUE_SIZE*sizeof.socket_queue_entry - sizeof.queue)
|
SOCKET_QUEUE_LOCATION = (SOCKET_STRUCT_SIZE - SOCKET_QUEUE_SIZE*sizeof.socket_queue_entry - sizeof.queue)
|
||||||
|
|
||||||
uglobal
|
uglobal
|
||||||
align 4
|
align 4
|
||||||
@ -1368,7 +1368,7 @@ socket_debug:
|
|||||||
jz .invalid
|
jz .invalid
|
||||||
|
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
mov ecx, SOCKETBUFFSIZE/4
|
mov ecx, SOCKET_STRUCT_SIZE/4
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
mov dword[esp+32], 0
|
mov dword[esp+32], 0
|
||||||
@ -1591,7 +1591,7 @@ socket_ring_create:
|
|||||||
mov esi, eax
|
mov esi, eax
|
||||||
|
|
||||||
push edx
|
push edx
|
||||||
stdcall create_ring_buffer, SOCKET_MAXDATA, PG_SWR
|
stdcall create_ring_buffer, SOCKET_BUFFER_SIZE, PG_SWR
|
||||||
pop edx
|
pop edx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
@ -1607,7 +1607,7 @@ socket_ring_create:
|
|||||||
mov [esi + RING_BUFFER.write_ptr], eax
|
mov [esi + RING_BUFFER.write_ptr], eax
|
||||||
mov [esi + RING_BUFFER.read_ptr], eax
|
mov [esi + RING_BUFFER.read_ptr], eax
|
||||||
mov [esi + RING_BUFFER.size], 0
|
mov [esi + RING_BUFFER.size], 0
|
||||||
add eax, SOCKET_MAXDATA
|
add eax, SOCKET_BUFFER_SIZE
|
||||||
mov [esi + RING_BUFFER.end_ptr], eax
|
mov [esi + RING_BUFFER.end_ptr], eax
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
|
|
||||||
@ -1642,7 +1642,7 @@ socket_ring_write:
|
|||||||
popa
|
popa
|
||||||
|
|
||||||
; calculate available size
|
; calculate available size
|
||||||
mov edi, SOCKET_MAXDATA
|
mov edi, SOCKET_BUFFER_SIZE
|
||||||
sub edi, [eax + RING_BUFFER.size] ; available buffer size in edi
|
sub edi, [eax + RING_BUFFER.size] ; available buffer size in edi
|
||||||
cmp ecx, edi
|
cmp ecx, edi
|
||||||
jbe .copy
|
jbe .copy
|
||||||
@ -1656,7 +1656,7 @@ socket_ring_write:
|
|||||||
add edi, ecx
|
add edi, ecx
|
||||||
cmp edi, [eax + RING_BUFFER.end_ptr]
|
cmp edi, [eax + RING_BUFFER.end_ptr]
|
||||||
jb @f
|
jb @f
|
||||||
sub edi, SOCKET_MAXDATA ; WRAP
|
sub edi, SOCKET_BUFFER_SIZE ; WRAP
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov [eax + RING_BUFFER.write_ptr], edi
|
mov [eax + RING_BUFFER.write_ptr], edi
|
||||||
@ -1790,7 +1790,7 @@ socket_ring_free:
|
|||||||
mov edx, [eax + RING_BUFFER.end_ptr]
|
mov edx, [eax + RING_BUFFER.end_ptr]
|
||||||
cmp [eax + RING_BUFFER.read_ptr], edx
|
cmp [eax + RING_BUFFER.read_ptr], edx
|
||||||
jb @f
|
jb @f
|
||||||
sub [eax + RING_BUFFER.read_ptr], SOCKET_MAXDATA
|
sub [eax + RING_BUFFER.read_ptr], SOCKET_BUFFER_SIZE
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
push eax ecx
|
push eax ecx
|
||||||
@ -1905,9 +1905,9 @@ socket_notify:
|
|||||||
; Socket and thread exists and socket is of non blocking type.
|
; Socket and thread exists and socket is of non blocking type.
|
||||||
; We'll try to flag an event to the thread.
|
; We'll try to flag an event to the thread.
|
||||||
shl ecx, 8
|
shl ecx, 8
|
||||||
or [ecx + SLOT_BASE + APPDATA.event_mask], EVENT_NETWORK
|
or [SLOT_BASE + ecx + APPDATA.event_mask], EVENT_NETWORK
|
||||||
|
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: poking thread %u!\n", eax
|
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: poking thread %u!\n", ebx
|
||||||
pop esi ecx ebx
|
pop esi ecx ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1941,7 +1941,7 @@ socket_alloc:
|
|||||||
|
|
||||||
push ebx
|
push ebx
|
||||||
|
|
||||||
stdcall kernel_alloc, SOCKETBUFFSIZE
|
stdcall kernel_alloc, SOCKET_STRUCT_SIZE
|
||||||
or eax, eax
|
or eax, eax
|
||||||
jz .nomem
|
jz .nomem
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_alloc: ptr=%x\n", eax
|
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_alloc: ptr=%x\n", eax
|
||||||
@ -1949,7 +1949,7 @@ socket_alloc:
|
|||||||
; zero-initialize allocated memory
|
; zero-initialize allocated memory
|
||||||
push eax
|
push eax
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov ecx, SOCKETBUFFSIZE / 4
|
mov ecx, SOCKET_STRUCT_SIZE / 4
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
pop eax
|
pop eax
|
||||||
|
@ -117,7 +117,7 @@ SS_MORETOCOME = 0x4000
|
|||||||
SS_BLOCKED = 0x8000
|
SS_BLOCKED = 0x8000
|
||||||
|
|
||||||
|
|
||||||
SOCKET_MAXDATA = 4096*64 ; must be 4096*(power of 2) where 'power of 2' is at least 8
|
SOCKET_BUFFER_SIZE = 4096*8 ; must be 4096*(power of 2) where 'power of 2' is at least 8
|
||||||
MAX_backlog = 20 ; maximum backlog for stream sockets
|
MAX_backlog = 20 ; maximum backlog for stream sockets
|
||||||
|
|
||||||
; Error Codes
|
; Error Codes
|
||||||
|
@ -559,7 +559,7 @@ endl
|
|||||||
|
|
||||||
; Calculate receive window size
|
; Calculate receive window size
|
||||||
push edx
|
push edx
|
||||||
mov eax, SOCKET_MAXDATA
|
mov eax, SOCKET_BUFFER_SIZE
|
||||||
sub eax, [ebx + STREAM_SOCKET.rcv.size]
|
sub eax, [ebx + STREAM_SOCKET.rcv.size]
|
||||||
DEBUGF DEBUG_NETWORK_VERBOSE, "Space in receive buffer=%d\n", eax
|
DEBUGF DEBUG_NETWORK_VERBOSE, "Space in receive buffer=%d\n", eax
|
||||||
mov edx, [ebx + TCP_SOCKET.RCV_ADV]
|
mov edx, [ebx + TCP_SOCKET.RCV_ADV]
|
||||||
@ -1436,7 +1436,7 @@ align 4
|
|||||||
|
|
||||||
movzx eax, [edx + TCP_header.UrgentPointer]
|
movzx eax, [edx + TCP_header.UrgentPointer]
|
||||||
add eax, [ebx + STREAM_SOCKET.rcv.size]
|
add eax, [ebx + STREAM_SOCKET.rcv.size]
|
||||||
cmp eax, SOCKET_MAXDATA
|
cmp eax, SOCKET_BUFFER_SIZE
|
||||||
jbe .not_urgent
|
jbe .not_urgent
|
||||||
|
|
||||||
mov [edx + TCP_header.UrgentPointer], 0
|
mov [edx + TCP_header.UrgentPointer], 0
|
||||||
|
@ -163,7 +163,7 @@ endl
|
|||||||
;-------------------------------
|
;-------------------------------
|
||||||
; calculate window advertisement (130)
|
; calculate window advertisement (130)
|
||||||
|
|
||||||
mov ecx, SOCKET_MAXDATA
|
mov ecx, SOCKET_BUFFER_SIZE
|
||||||
sub ecx, [eax + STREAM_SOCKET.rcv.size]
|
sub ecx, [eax + STREAM_SOCKET.rcv.size]
|
||||||
|
|
||||||
;------------------------------
|
;------------------------------
|
||||||
@ -448,10 +448,10 @@ endl
|
|||||||
; Calculate the receive window.
|
; Calculate the receive window.
|
||||||
; Dont shrink window, but avoid silly window syndrome
|
; Dont shrink window, but avoid silly window syndrome
|
||||||
|
|
||||||
mov ebx, SOCKET_MAXDATA
|
mov ebx, SOCKET_BUFFER_SIZE
|
||||||
sub ebx, [eax + STREAM_SOCKET.rcv.size]
|
sub ebx, [eax + STREAM_SOCKET.rcv.size]
|
||||||
|
|
||||||
cmp ebx, SOCKET_MAXDATA/4
|
cmp ebx, SOCKET_BUFFER_SIZE/4
|
||||||
jae @f
|
jae @f
|
||||||
cmp ebx, [eax + TCP_SOCKET.t_maxseg]
|
cmp ebx, [eax + TCP_SOCKET.t_maxseg]
|
||||||
jae @f
|
jae @f
|
||||||
|
Loading…
Reference in New Issue
Block a user