210,9 → 210,7 |
|
pusha |
|
; FIXME: make this a proper stream! |
|
.nextpacket: |
.recv_more: |
mcall recv, [socketnum], packetbuf, PACKETBUF_SIZE, MSG_DONTWAIT ; read a packet |
inc eax ; check if we got any data |
jz .done ; TODO: handle errors! |
223,11 → 221,11 |
|
mov ecx, eax |
mov esi, packetbuf ; esi = start pointer |
.nextcommand: |
mov edi, servercommand |
add edi, [cmd_remaining] |
.byteloop: |
test ecx, ecx |
jz .nextpacket |
jz .recv_more |
lodsb |
dec ecx |
cmp al, 10 |
234,6 → 232,8 |
je .got_command |
cmp al, 13 |
je .got_command |
cmp edi, servercommand + SERVERCOMMAND_SIZE ; Prevent command buffer overflow |
jae .byteloop |
stosb |
jmp .byteloop |
|
249,8 → 249,12 |
sub ecx, servercommand ; put length in ecx |
call server_parser |
pop ecx esi |
jmp .nextcommand |
|
.nextcommand: |
mov edi, servercommand |
mov [cmd_remaining], ecx ; remaining bytes since last EOL |
jmp .byteloop |
|
.done: |
popa |
ret |