Skip to content

Commit

Permalink
Removed time ops from wire protocol, removed aesop threadpools that c…
Browse files Browse the repository at this point in the history
…aused issue #3.
  • Loading branch information
GeoffDanielson committed Feb 4, 2016
1 parent 03e1253 commit 8575d80
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 182 deletions.
98 changes: 0 additions & 98 deletions server/asg_exec.ae
Original file line number Diff line number Diff line change
Expand Up @@ -353,67 +353,6 @@ read_svc(struct asgop *op)
return 0;
}

__blocking int
time_svc(struct asgop *op) {
struct asgsvc *svc;
struct xm_message repl;
struct iovec iov;
time_t epoch;
XDR xdrs;
bool_t enc;
int rc;
struct TIME1args *arg;
struct TIME1res *r;

epoch = 0;

arg = &op->arg->c.request.SOS.SOSargs_u.t;
r = &op->arg->c.result.SOS.SOSres_u.t;

repl.flags = XM_F_IFWRONLY;
repl.addr = op->p->address;
repl.match = arg->ret;
repl.iov = &iov;
repl.iovcnt = 1;

epoch = time(NULL);

if (epoch == (time_t)(-1))
r->status = SOS1_FAIL;
else {
r->status = SOS1_OK;
r->TIME1res_u.time = epoch;
}

xdrmem_create(&xdrs, op->bp[0], sizeof(TIME1res), XDR_ENCODE);

enc = xdr_TIME1res(&xdrs, r);
if (enc == FALSE) {
ERR("XDR of time result failed\n");
}

iov.iov_base = op->bp[0];
iov.iov_len = xdr_getpos(&xdrs);

rc = sync_xm_op(xm_put, op->p->xmx, &repl);

if (repl.error) {
ERR("error: %s\n", strerror(repl.error));
}
if (rc != 0) {
ERR("Put of time result failed: %s\n", strerror(-rc));
}

if (r->status == SOS1_OK) {
free(op->buf);
op->buf = NULL;
}

INFO(2, "timesvc returning %d\n", r->status);

return 0;
}

/* Always returns 0. Errors are indicated in return structure. */
__blocking int
write_svc(struct asgop *op)
Expand Down Expand Up @@ -604,21 +543,8 @@ batch_svc(struct asgop *op) {

xdrmem_create(&xdrs, cmdbuf, arg->bufsiz, XDR_DECODE);

INFO(2, "creating thread pool\n");
b.t = aethread_create_group_pool(1);

if (b.t == NULL) {
free(op->buf);
free(op);
r->status = SOS1_FAIL;
INFO(2, "batch_svc aethread_create_group_pool returning %d\n",
r->status);
return 0;
}

pwait {
pbranch {
aethread_hint(b.t);
rc = _batch_svc(&b, &xdrs, svc, r);
}
}
Expand All @@ -628,8 +554,6 @@ batch_svc(struct asgop *op) {
b_free(&b);
}

aethread_destroy_group(b.t);

return 0;
}

Expand Down Expand Up @@ -765,17 +689,6 @@ prealloc(struct asgop *op) {
op->bp[0] = op->buf;
op->bp[1] = op->buf + op->arg->c.request.SOS.SOSargs_u.b.bufsiz;
break;
case SOS1_TIME:
len = sizeof(TIME1res);
op->bps = 1;
op->buf = malloc(len);
if (op->buf == NULL) {
errno = ENOMEM;
return -1;
}
memset(op->buf, 0, len);
op->bp[0] = op->buf;
break;
default:
ERR("unrecognized op: %d\n", op->op);
return -1;
Expand Down Expand Up @@ -948,15 +861,6 @@ sos_svc(struct asgarg *asgargs, struct peer_record *p, void *data)
bx->retbuf = NULL;
TAILQ_INIT(&bx->ops);

INFO(2, "creating thread pool\n");
bx->t = aethread_create_group_pool(1);

if (bx->t == NULL) {
free(bx);
r->status = SOS1_FAIL;
INFO(2, "sos_svc returning %d\n", r->status);
}

bx->p.xmx = p->xmx;
bx->p.address = ssm_addr_cp(p->xmx->ssm,
p->address);
Expand All @@ -971,7 +875,6 @@ sos_svc(struct asgarg *asgargs, struct peer_record *p, void *data)

pwait {
pbranch {
aethread_hint(bx->t);
rc = _sos_svc(bx, svc, r, b, cmdbuf, p, data);
}
}
Expand All @@ -981,7 +884,6 @@ sos_svc(struct asgarg *asgargs, struct peer_record *p, void *data)
b_free(bx);
} else if (rc == 0) {
INFO(2, "destroying batch\n");
aethread_destroy_group(bx->t);
ssm_addr_destroy(bx->p.xmx->ssm,
bx->p.address);
(void )hoss_end(bx->g, 1);
Expand Down
1 change: 0 additions & 1 deletion server/asg_exec.hae
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct asgbatch {
struct BATCH1res rc;
void *retbuf;
match1 ret;
struct aethread_group *t;
size_t len;
};

Expand Down
22 changes: 1 addition & 21 deletions server/sos_prot.x
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ enum sosop1 {
SOS1_PUNCH = 3,
SOS1_BATCH = 4,
SOS1_COMMIT = 5,
SOS1_TIME = 6,
SOS1_WRITE = 7
SOS1_WRITE = 6
};

struct nsid1 {
Expand Down Expand Up @@ -116,28 +115,13 @@ struct BATCH1res {
sosstat1 status;
};

/* time */

struct TIME1args {
match1 ret;
};

union TIME1res switch (sosstat1 status) {
case SOS1_OK:
time1 time;
default:
void;
};

union SOSargs switch (sosop1 op) {
case SOS1_WRITE:
WRITE1args w;
case SOS1_READ:
READ1args r;
case SOS1_BATCH:
BATCH1args b;
case SOS1_TIME:
TIME1args t;
default:
void;
};
Expand All @@ -149,8 +133,6 @@ union SOSres switch (sosop1 op) {
READ1res r;
case SOS1_BATCH:
BATCH1res b;
case SOS1_TIME:
TIME1res t;
default:
void;
};
Expand All @@ -164,7 +146,5 @@ program SOS_PROGRAM {
version SOS1_VERSION {
BATCH1res
SOSBATCH1_OP(BATCH1args) = 1;
time_t
SOSSVR_TIME() = 4;
} = 1;
} = 0x20202020;
63 changes: 1 addition & 62 deletions sos/sos_prot.x
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ enum sosop1 {
SOS1_PUNCH = 3,
SOS1_BATCH = 4,
SOS1_COMMIT = 5,
SOS1_TIME = 6,
SOS1_WRITE = 7
SOS1_WRITE = 6
};

struct nsid1 {
Expand Down Expand Up @@ -116,28 +115,13 @@ struct BATCH1res {
sosstat1 status;
};

/* time */

struct TIME1args {
match1 ret;
};

union TIME1res switch (sosstat1 status) {
case SOS1_OK:
time1 time;
default:
void;
};

union SOSargs switch (sosop1 op) {
case SOS1_WRITE:
WRITE1args w;
case SOS1_READ:
READ1args r;
case SOS1_BATCH:
BATCH1args b;
case SOS1_TIME:
TIME1args t;
default:
void;
};
Expand All @@ -149,49 +133,10 @@ union SOSres switch (sosop1 op) {
READ1res r;
case SOS1_BATCH:
BATCH1res b;
case SOS1_TIME:
TIME1res t;
default:
void;
};

const MMBRLIST_MAX_ADDR_LEN = 128;
const MMBRLIST_MAX_ADDRS = 32;

struct addrspec {
opaque a<MMBRLIST_MAX_ADDR_LEN>;
};

struct MMBRLIST1args {
struct addrspec addr;
uint32_t ttl;
};

struct MMBRLIST1resok {
struct addrspec addr<MMBRLIST_MAX_ADDRS>;
};

union MMBRLIST1res switch (sosstat1 status) {
case SOS1_OK:
MMBRLIST1resok resok;
default:
void;
};

enum MMBRADD1_JOINTYPE {
RANDOM = 1,
NEARBY = 2
};

struct MMBRADD1args {
MMBRADD1_JOINTYPE type;
struct addrspec reply_addr;
};

struct MMBRADD1res {
sosstat1 status;
};

struct msg_header {
proc1 proc;
match1 reply;
Expand All @@ -201,11 +146,5 @@ program SOS_PROGRAM {
version SOS1_VERSION {
BATCH1res
SOSBATCH1_OP(BATCH1args) = 1;
MMBRLIST1res
MMBRPROC1_LIST(MMBRLIST1args) = 2;
MMBRADD1res
MMBRPROC1_ADD(MMBRADD1args) = 3;
time_t
SOSSVR_TIME() = 4;
} = 1;
} = 0x20202020;

0 comments on commit 8575d80

Please sign in to comment.