Commit 222ab05d authored by Mike Hibler's avatar Mike Hibler

Pooched the backward-compat case.

I thought I would be clever and check the client ID on a JOIN reply
to make sure we match up the proper request/reply (an issue when replies
are multicast). However, on a JOINv1, the reply does not include the
clientid. Unfortunately, for previous backward-compat situations, we
still do generate JOINv1 requests most of the time.

So for JOINv1's we don't try to check the clientid. This means that
with a newer server that MCs replies, a JOINv1 client may see someone
else's reply and start transmitting requests even before the server
has seen that client's join request. This is not an issue for us right
now since the server only loosely tracks its clients and does so just
so that it can report stats when the client leaves. I say "loosely"
because, e.g., the server does not require that block requests come
from a JOIN'ed client.
parent 89fe803f
......@@ -1800,7 +1800,7 @@ PlayFrisbee(void)
Packet_t packet, *p = &packet;
struct timeval estamp, timeo;
unsigned int myid;
int delay, rv;
int delay, rv, checkid = 0;
int32_t jtype = 0;
gettimeofday(&stamp, 0);
......@@ -1884,12 +1884,14 @@ PlayFrisbee(void)
jtype = p->hdr.subtype = PKTSUBTYPE_JOIN;
p->hdr.datalen = sizeof(p->msg.join);
p->msg.join.clientid = myid;
checkid = 0;
} else {
jtype = p->hdr.subtype = PKTSUBTYPE_JOIN2;
p->hdr.datalen = sizeof(p->msg.join2);
p->msg.join2.clientid = myid;
p->msg.join2.chunksize = MAXCHUNKSIZE;
p->msg.join2.blocksize = MAXBLOCKSIZE;
checkid = 1;
}
PacketSend(p, 0);
timeo.tv_sec = 0;
......@@ -1926,7 +1928,7 @@ PlayFrisbee(void)
if (rv == 0 &&
p->hdr.subtype == jtype &&
p->hdr.type == PKTTYPE_REPLY &&
p->msg.join.clientid == myid) {
(!checkid || p->msg.join.clientid == myid)) {
if (jtype == PKTSUBTYPE_JOIN) {
p->msg.join2.chunksize = MAXCHUNKSIZE;
p->msg.join2.blocksize = MAXBLOCKSIZE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment