mirror of
https://github.com/yarrick/iodine.git
synced 2024-12-23 05:43:32 +02:00
send final bit to server
This commit is contained in:
parent
fb429260a1
commit
f2b17dfda5
1 changed files with 6 additions and 0 deletions
6
dns.c
6
dns.c
|
@ -261,6 +261,7 @@ dns_write(int fd, int id, char *buf, int len)
|
|||
{
|
||||
int avail;
|
||||
int i;
|
||||
int final;
|
||||
int parts;
|
||||
int p;
|
||||
char data[257];
|
||||
|
@ -276,8 +277,13 @@ dns_write(int fd, int id, char *buf, int len)
|
|||
avail -= (avail/CHUNK); // make space for parts
|
||||
|
||||
avail = MIN(avail, len); // do not use more bytes than is available;
|
||||
final = (avail == len); // is this the last block?
|
||||
d = data;
|
||||
|
||||
// First byte is 0 for middle packet and 1 for last packet
|
||||
*d = '0' + final;
|
||||
d++;
|
||||
|
||||
parts = avail / CHUNK;
|
||||
for (p = 0; p < parts; p++) {
|
||||
for (i = 0; i < CHUNK; i++) {
|
||||
|
|
Loading…
Reference in a new issue