Subversion Repositories Kolibri OS

Rev

Rev 9979 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9979 Rev 9984
Line 208... Line 208...
208
 
208
 
Line 209... Line 209...
209
socket_receive:
209
socket_receive:
Line 210... Line -...
210
 
-
 
211
        pusha
-
 
212
 
210
 
213
; FIXME: make this a proper stream!
211
        pusha
214
 
212
 
215
  .nextpacket:
213
  .recv_more:
216
        mcall   recv, [socketnum], packetbuf, PACKETBUF_SIZE, MSG_DONTWAIT    ; read a packet
214
        mcall   recv, [socketnum], packetbuf , PACKETBUF_SIZE, MSG_DONTWAIT    ; read a packet
217
        inc     eax                                                           ; check if we got any data
215
        inc     eax                                                           ; check if we got any data
Line 218... Line 216...
218
        jz      .done                                                         ; TODO: handle errors!
216
        jz      .done                                                         ; TODO: handle errors!
Line 219... Line 217...
219
        dec     eax
217
        dec     eax
220
        jz      .disconnected
218
        jz      .disconnected
221
 
-
 
222
; ok we have data, now feed it to the command splicer
219
 
-
 
220
; ok we have data, now feed it to the command splicer
223
 
221
 
224
        mov     ecx, eax
222
        mov     ecx, eax
225
        mov     esi, packetbuf                          ; esi = start pointer
223
        mov     esi, packetbuf                          ; esi = start pointer
226
  .nextcommand:
224
        mov     edi, servercommand
227
        mov     edi, servercommand
225
        add     edi, [cmd_remaining]
228
  .byteloop:
226
  .byteloop:
229
        test    ecx, ecx
227
        test    ecx, ecx
230
        jz      .nextpacket
228
        jz      .recv_more
231
        lodsb
229
        lodsb
-
 
230
        dec     ecx
-
 
231
        cmp     al, 10
232
        dec     ecx
232
        je      .got_command
233
        cmp     al, 10
233
        cmp     al, 13
Line 234... Line 234...
234
        je      .got_command
234
        je      .got_command
Line 247... Line 247...
247
        push    esi ecx
247
        push    esi ecx
248
        mov     ecx, edi
248
        mov     ecx, edi
249
        sub     ecx, servercommand                      ; put length in ecx
249
        sub     ecx, servercommand                      ; put length in ecx
250
        call    server_parser
250
        call    server_parser
251
        pop     ecx esi
251
        pop     ecx esi
-
 
252
 
-
 
253
  .nextcommand:
-
 
254
        mov     edi, servercommand
-
 
255
        mov     [cmd_remaining], ecx                    ; remaining bytes since last EOL
252
        jmp     .nextcommand
256
        jmp     .byteloop
Line 253... Line 257...
253
 
257
 
254
  .done:
258
  .done:
255
        popa
259
        popa