send final bit to server
This commit is contained in:
parent
fb429260a1
commit
f2b17dfda5
6
dns.c
6
dns.c
|
@ -261,6 +261,7 @@ dns_write(int fd, int id, char *buf, int len)
|
||||||
{
|
{
|
||||||
int avail;
|
int avail;
|
||||||
int i;
|
int i;
|
||||||
|
int final;
|
||||||
int parts;
|
int parts;
|
||||||
int p;
|
int p;
|
||||||
char data[257];
|
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 -= (avail/CHUNK); // make space for parts
|
||||||
|
|
||||||
avail = MIN(avail, len); // do not use more bytes than is available;
|
avail = MIN(avail, len); // do not use more bytes than is available;
|
||||||
|
final = (avail == len); // is this the last block?
|
||||||
d = data;
|
d = data;
|
||||||
|
|
||||||
|
// First byte is 0 for middle packet and 1 for last packet
|
||||||
|
*d = '0' + final;
|
||||||
|
d++;
|
||||||
|
|
||||||
parts = avail / CHUNK;
|
parts = avail / CHUNK;
|
||||||
for (p = 0; p < parts; p++) {
|
for (p = 0; p < parts; p++) {
|
||||||
for (i = 0; i < CHUNK; i++) {
|
for (i = 0; i < CHUNK; i++) {
|
||||||
|
|
Loading…
Reference in New Issue