#10 fixed basic ack. pings bigger than 110 still lost

This commit is contained in:
Erik Ekman 2007-02-05 19:44:46 +00:00
parent 9b438c20d4
commit 9355cd7829
3 changed files with 16 additions and 17 deletions

View File

@ -150,7 +150,7 @@ dns_decode(char *buf, size_t buflen, struct query *q, qr_t qr, char *packet, siz
}
if (q != NULL)
q->id = header->id;
q->id = id;
readname(packet, packetlen, &data, name, sizeof(name));
readshort(packet, &data, &type);

View File

@ -73,7 +73,7 @@ send_packet(int fd, char cmd, const char *data, const size_t datalen)
char buf[4096];
size_t len;
q.id = rand_seed;
q.id = ++chunkid;
q.type = T_NULL;
buf[0] = cmd;
@ -229,7 +229,7 @@ send_chunk(int fd)
char *p;
int len;
q.id = rand_seed;
q.id = ++chunkid;
q.type = T_NULL;
p = activepacket;
@ -239,7 +239,7 @@ send_chunk(int fd)
lastlen = dns_build_hostname(buf + 1, sizeof(buf) - 1, p, avail, topdomain);
if (lastlen == avail)
buf[0] = '1';
else
else
buf[0] = '0';
len = dns_encode(packet, sizeof(packet), &q, QR_QUERY, buf, strlen(buf));
@ -340,10 +340,10 @@ handshake(int dns_fd)
if (read >= 8) {
memcpy(&seed, in + 4, 4);
seed = ntohl(seed);
printf("version ok, both running 0x%08x\n", VERSION);
printf("Version ok, both running 0x%08x\n", VERSION);
break;
} else {
printf("version ok but did not receive proper login challenge\n");
printf("Version ok but did not receive proper login challenge\n");
}
} else {
memcpy(&version, in + 4, 4);
@ -475,6 +475,7 @@ main(int argc, char **argv)
username = NULL;
memset(password, 0, 33);
foreground = 0;
chunkid = 0;
newroot = NULL;
device = NULL;

View File

@ -25,23 +25,21 @@
START_TEST(test_encoding_base32)
{
char temp[256];
char *start = "HELLOTEST";
char *out = "1HELLOTEST";
char *end;
char end[256];
char *start = "1HELLOTEST";
char *tempend;
int codedlength;
int len;
memset(temp, 0, sizeof(temp));
end = malloc(16);
memset(end, 0, 16);
memset(end, 0, sizeof(end));
codedlength = encode_data(start, 9, 256, temp);
encode_data(start, 9, 256, temp);
tempend = temp + strlen(temp);
decode_data(end, 16, temp, tempend);
printf("%d '%s'\n", strlen(temp), temp);
len = decode_data(end, sizeof(end), temp, tempend);
fail_unless(strcmp(out, end) == 0, NULL);
free(end);
printf("%d %d '%s'\n", len, strlen(end), end);
fail_unless(strcmp(start, end) == 0, NULL);
}
END_TEST