Rev 4143 | Rev 4623 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4143 | Rev 4477 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; Written by hidnplayr@kolibrios.org ;; |
6 | ;; Written by hidnplayr@kolibrios.org ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; GNU GENERAL PUBLIC LICENSE ;; |
8 | ;; GNU GENERAL PUBLIC LICENSE ;; |
Line 98... | Line 98... | ||
98 | call print_text2 |
98 | call print_text2 |
Line 99... | Line 99... | ||
99 | 99 | ||
Line 100... | Line 100... | ||
100 | ret |
100 | ret |
101 | - | ||
102 | .reconnect: |
101 | |
103 | 102 | .reconnect: |
|
104 | if TIMESTAMP |
103 | if TIMESTAMP |
105 | call print_timestamp |
104 | call print_timestamp |
106 | end if |
105 | end if |
Line 211... | Line 210... | ||
211 | 210 | ||
Line 212... | Line 211... | ||
212 | ; TODO: read more data if we receive one full packet |
211 | ; TODO: read more data if we receive one full packet |
213 | 212 | ||
214 | .nextpacket: |
213 | .nextpacket: |
215 | mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet |
214 | mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet |
216 | inc eax ; check if we got one |
215 | inc eax ; check if we got any data |
217 | jz .done |
216 | jz .done ; TODO: handle errors! |
Line 218... | Line 217... | ||
218 | dec eax |
217 | dec eax |
Line 219... | Line 218... | ||
219 | jz .done ; TODO: check for errors! |
218 | jz .disconnected |
220 | 219 | ||
221 | ; ok we have data, now feed it to the recoder |
220 | ; ok we have data, now feed it to the recoder |
222 | 221 | ||
223 | lea edx, [packetbuf + eax] ; edx = end pointer |
222 | lea edx, [packetbuf + eax] ; edx = end pointer |
224 | mov esi, packetbuf ; esi = start pointer |
223 | mov esi, packetbuf ; esi = start pointer |
225 | .nextcommand: |
224 | .nextcommand: |
226 | mov edi, servercommand |
225 | mov edi, servercommand |
227 | .byteloop: |
226 | .byteloop: |
228 | call get_next_byte ; reads byte from [esi] to al |
227 | call get_next_byte ; reads byte from [esi] to al |
229 | jnc .nextpacket ; if CF is set, we need more data |
228 | jnc .nextpacket ; if CF is set, we need more data (TODO: dont throw away old data!!!) |
230 | cmp al, 10 |
229 | cmp al, 10 |
Line 243... | Line 242... | ||
243 | pop edx esi |
242 | pop edx esi |
244 | jmp .nextcommand |
243 | jmp .nextcommand |
Line 245... | Line 244... | ||
245 | 244 | ||
246 | .done: |
245 | .done: |
- | 246 | popa |
|
Line -... | Line 247... | ||
- | 247 | ret |
|
- | 248 | ||
- | 249 | ||
- | 250 | .disconnected: |
|
- | 251 | mov esi, str_disconnected |
|
- | 252 | call print_text2 |
|
- | 253 | ||
- | 254 | mov [status], STATUS_DISCONNECTED |
|
- | 255 | mcall close, [socketnum] |
|
247 | popa |
256 | |
248 | 257 | popa |