--- libaitrpc/example/tsrv.c 2011/09/01 14:26:22 1.3.2.4 +++ libaitrpc/example/tsrv.c 2011/09/03 12:57:59 1.3.2.9 @@ -54,7 +54,6 @@ int BBB(rpc_func_t *f, int in, array_t *iv) // rpc_srv_unregisterBLOB(f->func_parent, AIT_GET_BLOB(io_array(iv, 2, ait_val_t*))); - rpc_srv_allocVars(f, 3); rpc_srv_getVars(f, &arr); v = io_array(arr, 0, ait_val_t*); AIT_SET_BUF(v, "00!oo", 6); @@ -64,22 +63,19 @@ int BBB(rpc_func_t *f, int in, array_t *iv) AIT_SET_STR(v, "Oho boho i cheburashka"); // return blob object -// b = rpc_srv_registerBLOB(f->func_parent, 128); -// if (!b) -// return -1; -// else -// AIT_SET_BLOB2(io_array(arr, 3, ait_val_t*), b); + b = rpc_srv_registerBLOB(f->func_parent, 128); + if (!b) + return -1; + else { + v = io_array(arr, 3, ait_val_t*); + AIT_SET_BLOB2(v, b); + } -// if (rpc_srv_blobMap(f->func_parent, b) == -1) { -// rpc_srv_blobFree(f->func_parent, b); -// return -1; -// } + printf("data=%p blen=%d\n", b->blob_data, b->blob_len); + memset(b->blob_data, 0, b->blob_len); + strcpy(b->blob_data, "Hello Worldzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz mzdnfdskf\naddfs\n"); -// printf("data=%p blen=%d\n", b->blob_data, b->blob_len); -// memset(b->blob_data, 0, b->blob_len); -// strcpy(b->blob_data, "Hello Worldzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz mzdnfdskf\naddfs\n"); - -// rpc_srv_blobUnmap(b); + rpc_srv_blobUnmap(b); return 33; } @@ -97,18 +93,16 @@ int main() return 1; } - /* if (rpc_srv_initBLOBServer(srv, 0, "/tmp")) { printf("error:: errno=%d %s\n", rpc_GetErrno(), rpc_GetError()); return 1; } - */ if (!fork()) { setsid(); rpc_srv_registerCall(srv, NULL, "aaa", 0); - rpc_srv_registerCall(srv, NULL, "BBB", /*4*/ 3); + rpc_srv_registerCall(srv, NULL, "BBB", 4); rpc_srv_registerCall(srv, NULL, "dummy", 1); rpc_srv_registerCall(srv, NULL, "xYz", 2); @@ -122,12 +116,11 @@ int main() for (f = srv->srv_funcs; f; f = f->func_next) printf("1.func::name=%s args=%d\n", f->func_name, io_arraySize(f->func_vars)); -// pthread_create(&tid[1], NULL, (void*(*)(void*)) rpc_srv_execBLOBServer, srv); -// pthread_detach(tid[1]); - rpc_srv_execServer(srv); +// rpc_srv_loopServer(srv); + rpc_srv_execServer(srv, &ret); } -// rpc_srv_endBLOBServer(srv); + rpc_srv_endBLOBServer(srv); rpc_srv_endServer(srv); return 0; }