send final bit to server

This commit is contained in:
Erik Ekman 2006-06-05 20:31:59 +00:00
parent fb429260a1
commit f2b17dfda5

6
dns.c
View File

@ -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++) {