version 1.13.2.3, 2013/07/15 14:27:28
|
version 1.14.22.1, 2014/01/28 14:04:57
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 | Copyright 2004 - 2014 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 46 SUCH DAMAGE.
|
Line 46 SUCH DAMAGE.
|
#include "global.h" |
#include "global.h" |
|
|
|
|
|
static void * |
|
toutBLOB(sched_task_t *task) |
|
{ |
|
rpc_srv_unregisterBLOB(TASK_DATA(task), ((rpc_blob_t*) TASK_ARG(task))->blob_var); |
|
|
|
return NULL; |
|
} |
|
|
|
|
/* |
/* |
* rpc_srv_blobCreate() - Create and map blob to memory region and return object |
* rpc_srv_blobCreate() - Create and map blob to memory region and return object |
* |
* |
* @srv = RPC Server instance |
* @srv = RPC Server instance |
* @len = BLOB length object |
* @len = BLOB length object |
|
* @tout = BLOB live timeout in seconds |
* return: NULL error or !=NULL allocated BLOB object |
* return: NULL error or !=NULL allocated BLOB object |
*/ |
*/ |
rpc_blob_t * |
rpc_blob_t * |
rpc_srv_blobCreate(rpc_srv_t * __restrict srv, int len) | rpc_srv_blobCreate(rpc_srv_t * __restrict srv, int len, int tout) |
{ |
{ |
rpc_blob_t *blob = NULL; |
rpc_blob_t *blob = NULL; |
char szFName[MAXPATHLEN]; |
char szFName[MAXPATHLEN]; |
int f; |
int f; |
u_int rnd; |
u_int rnd; |
|
struct timespec ts = { tout ? tout : RPC_BLOB_TIMEOUT, 0 }; |
|
|
again: |
again: |
rnd = random() % UINT_MAX; |
rnd = random() % UINT_MAX; |
Line 101 again:
|
Line 112 again:
|
|
|
blob->blob_len = len; |
blob->blob_len = len; |
blob->blob_var = rnd; |
blob->blob_var = rnd; |
|
|
|
schedTimer(srv->srv_blob.root, toutBLOB, blob, ts, srv, 0); |
return blob; |
return blob; |
} |
} |
|
|
Line 181 rpc_srv_blobFree(rpc_srv_t * __restrict srv, rpc_blob_
|
Line 194 rpc_srv_blobFree(rpc_srv_t * __restrict srv, rpc_blob_
|
return -1; |
return -1; |
} else |
} else |
rpc_srv_blobUnmap(blob); |
rpc_srv_blobUnmap(blob); |
|
|
|
schedCancelby(srv->srv_blob.root, taskTIMER, CRITERIA_ARG, blob, NULL); |
|
|
memset(szFName, 0, sizeof szFName); |
memset(szFName, 0, sizeof szFName); |
snprintf(szFName, sizeof szFName, BLOB_FILE, AIT_GET_STRZ(&srv->srv_blob.dir), blob->blob_var); |
snprintf(szFName, sizeof szFName, BLOB_FILE, AIT_GET_STRZ(&srv->srv_blob.dir), blob->blob_var); |