save works
This commit is contained in:
parent
f4b1ba4cd7
commit
acfbec875b
51 changed files with 622 additions and 1175 deletions
|
|
@ -161,7 +161,31 @@ static typeinfo_t worker_type = {
|
|||
|
||||
worker_t* makeWorker(var workermgr, xce_worker_t* w)
|
||||
{
|
||||
worker_t* worker = makeInstance(&worker_type, w);
|
||||
/* fIXME */
|
||||
worker_t* worker = NULL;
|
||||
int rc = 0;
|
||||
|
||||
rc = key_find(workermgr, (void*)w->name, (void**)&worker);
|
||||
if ((rc < 0) && (rc != -ENOENT)) {
|
||||
errno = -rc;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (rc > 0) {
|
||||
errno = EEXIST;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
worker = makeInstance(&worker_type, w);
|
||||
if (worker != NULL) {
|
||||
reference(worker);
|
||||
rc = key_add(workermgr, (void*)worker->host.name, (void*)worker);
|
||||
if (rc < 0) {
|
||||
destroy(worker);
|
||||
|
||||
errno = -rc;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return worker;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue