Commit 7523a98c authored by Leigh B. Stoller's avatar Leigh B. Stoller

Remove all of the connection handling stuff. Clients come and go, and

idleness is defined as an empty work queue. We still use join/leave
messages, but the join message is so that the client can be informed
of the number of blocks in the file. The leave message is strictly
informational, and includes the elapsed time on the client, so that it
can be written to the log file. If that message is lost, no big deal.
I ran a 6 node test on this new code, and all the clients ran in 174
to 176 seconds, with frisbeed using 1% CPU on average (typically
starts out at about 3%, and quickly drops off to steady state).
parent 29552163
......@@ -535,37 +535,21 @@ PlayFrisbee(void)
gettimeofday(&estamp, 0);
estamp.tv_sec -= stamp.tv_sec;
* Done! Handshake our exit with the server.
* Done! Send off a leave message, but do not worry about whether
* the server gets it. All the server does with it is print a
* timestamp, and that is not critical to operation.
while (1) {
int countdown = 0;
if (countdown <= 0) {
p->hdr.type = PKTTYPE_REQUEST;
p->hdr.subtype = PKTSUBTYPE_LEAVE;
p->hdr.datalen = sizeof(p->msg.join);
p->msg.join.clientid = myid;
countdown = 3;
* Throw away any data packets until we get a reply back.
* Wait several receive delays before resending the message.
if (PacketReceive(p) < 0) {
p->hdr.type = PKTTYPE_REQUEST;
p->hdr.subtype = PKTSUBTYPE_LEAVE;
p->hdr.datalen = sizeof(p->msg.leave);
p->msg.leave.clientid = myid;
p->msg.leave.elapsed = estamp.tv_sec;
if (p->hdr.subtype == PKTSUBTYPE_LEAVE &&
p->hdr.type == PKTTYPE_REPLY) {
gettimeofday(&estamp, 0);
estamp.tv_sec -= stamp.tv_sec;
log("Left the team after %ld seconds on the field!", estamp.tv_sec);
......@@ -600,11 +584,7 @@ FrisbeeRead(void **buf, size_t count)
char *data = (char *) &ChunkBuffer[ImageUnzipBuffer].blocks;
data += ImageUnzipOffset;
#if 1
*buf = data;
memcpy(buf, data, count);
ImageUnzipOffset += count;
return count;
......@@ -4,12 +4,6 @@
#include "log.h"
* Max number of clients we can support at once. Not likely to be an issue
* since the amount of per client state is very little.
#define MAXCLIENTS 1000
* We operate in terms of this blocksize (in bytes).
......@@ -39,12 +33,10 @@
* Timeout (in usecs) for packet receive. The idletimer number is how
* many PKT timeouts we allow before requesting more data from the server.
* That is, if we go TIMEOUT usecs without getting a packet, then ask for
* more (or on the server side, poll the clients). On the server, side
* use a timeout to check for dead clients. We want that to be longish.
* more.
#define PKTRCV_TIMEOUT 30000
* Timeout (in seconds!) server will hang around with no active clients.
......@@ -70,12 +62,19 @@ typedef struct {
union {
* Join/leave the Team. Send a randomized ID, and receive
* the number of blocks in the file.
* the number of blocks in the file. This is strictly
* informational; the info is reported in the log file.
* We must return the number of chunks in the file though.
union {
unsigned int clientid;
int blockcount;
} join;
struct {
unsigned int clientid;
int elapsed; /* Stats only */
} leave;
* A data block, indexed by chunk,block.
This diff is collapsed.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment