|
|
| version 1.4.2.4, 2011/08/31 17:11:58 | version 1.4.2.7, 2011/09/01 14:55:42 |
|---|---|
| Line 97 rpc_srv_dispatchCall(void *arg) | Line 97 rpc_srv_dispatchCall(void *arg) |
| break; | break; |
| } | } |
| if (ret < sizeof(struct tagRPCCall)) { | if (ret < sizeof(struct tagRPCCall)) { |
| rpc_SetErr(EMSGSIZE, "Error:: too short RPC packet ...\n"); | rpc_SetErr(ERPCMISMATCH, "Error:: too short RPC packet ...\n"); |
| ret = -4; | ret = -4; |
| break; | break; |
| } else | } else |
| rpc = (struct tagRPCCall*) buf; | rpc = (struct tagRPCCall*) buf; |
| /* check RPC packet session info */ | /* check RPC packet session info */ |
| if (memcmp(&rpc->call_session, &s->srv_session, sizeof rpc->call_session)) { | if (memcmp(&rpc->call_session, &s->srv_session, sizeof rpc->call_session)) { |
| rpc_SetErr(EINVAL, "Error:: get invalid RPC session ...\n"); | rpc_SetErr(ERPCMISMATCH, "Error:: get invalid RPC session ...\n"); |
| ret = -5; | ret = -5; |
| goto makeReply; | goto makeReply; |
| } else | } else |
| Line 123 rpc_srv_dispatchCall(void *arg) | Line 123 rpc_srv_dispatchCall(void *arg) |
| argc = 0; | argc = 0; |
| memcpy(&ses, &rpc->call_session, sizeof ses); | memcpy(&ses, &rpc->call_session, sizeof ses); |
| if (!(f = rpc_srv_getCall(s, rpc->call_tag, rpc->call_hash))) { | if (!(f = rpc_srv_getCall(s, rpc->call_tag, rpc->call_hash))) { |
| rpc_SetErr(EINVAL, "Error:: call not found into RPC server ...\n"); | rpc_SetErr(EPROGUNAVAIL, "Error:: call not found into RPC server ...\n"); |
| ret = -6; | ret = -6; |
| } else | } else |
| if ((ret = rpc_srv_execCall(f, rpc, arr)) == -1) | if ((ret = rpc_srv_execCall(f, rpc, arr)) == -1) |
| ret = -9; | ret = -9; |
| else { | else { |
| io_arrayDestroy(&arr); | if (arr) |
| io_arrayDestroy(&arr); | |
| argc = rpc_srv_getVars(f, &arr); | argc = rpc_srv_getVars(f, &arr); |
| goto makeReply; /* Call finish OK */ | goto makeReply; /* Call finish OK */ |
| } | } |
| io_arrayDestroy(&arr); | if (arr) |
| io_arrayDestroy(&arr); | |
| makeReply: | makeReply: |
| /* Made reply */ | /* Made reply */ |
| Line 152 makeReply: | Line 154 makeReply: |
| if (argc && arr) { | if (argc && arr) { |
| /* Go Encapsulate variables ... */ | /* Go Encapsulate variables ... */ |
| if ((i = io_vals2buffer(buf + Limit, s->srv_netbuf - Limit, arr)) == -1) { | if ((i = io_vals2buffer(buf + Limit, s->srv_netbuf - Limit, arr)) == -1) { |
| rpc_srv_freeVars(f); | rpc_srv_freeVals(f); |
| argc = 0; | argc = 0; |
| ret = -7; | ret = -7; |
| rpc_SetErr(EMSGSIZE, "Error:: in prepare RPC packet values (-7) ...\n"); | rpc_SetErr(EBADRPC, "Error:: in prepare RPC packet values (-7) ...\n"); |
| goto makeReply; | goto makeReply; |
| } else { | } else { |
| Limit += i; | Limit += i; |
| rpc_srv_freeVars(f); | rpc_srv_freeVals(f); |
| } | } |
| } | } |
| Line 171 makeReply: | Line 173 makeReply: |
| break; | break; |
| } | } |
| if (ret != Limit) { | if (ret != Limit) { |
| rpc_SetErr(ECANCELED, "Error:: in send RPC request, should be send %d bytes, " | rpc_SetErr(EPROCUNAVAIL, "Error:: in send RPC request, should be send %d bytes, " |
| "really is %d\n", Limit, ret); | "really is %d\n", Limit, ret); |
| ret = -9; | ret = -9; |
| break; | break; |
| Line 238 rpc_srv_dispatchVars(void *arg) | Line 240 rpc_srv_dispatchVars(void *arg) |
| break; | break; |
| } | } |
| if (ret < sizeof(struct tagBLOBHdr)) { | if (ret < sizeof(struct tagBLOBHdr)) { |
| rpc_SetErr(EMSGSIZE, "Error:: too short BLOB packet ...\n"); | rpc_SetErr(ERPCMISMATCH, "Error:: too short BLOB packet ...\n"); |
| ret = -4; | ret = -4; |
| break; | break; |
| } else | } else |
| Line 282 rpc_srv_dispatchVars(void *arg) | Line 284 rpc_srv_dispatchVars(void *arg) |
| ret = -7; | ret = -7; |
| break; | break; |
| default: | default: |
| rpc_SetErr(EINVAL, "Error:: unsupported BLOB command (%d)...\n", | rpc_SetErr(EPROCUNAVAIL, "Error:: unsupported BLOB command (%d)...\n", |
| blob->hdr_cmd); | blob->hdr_cmd); |
| ret = -7; | ret = -7; |
| } | } |
| Line 298 makeReply: | Line 300 makeReply: |
| break; | break; |
| } | } |
| if (ret != sizeof buf) { | if (ret != sizeof buf) { |
| rpc_SetErr(ECANCELED, "Error:: in send BLOB reply, should be send %d bytes, " | rpc_SetErr(EPROCUNAVAIL, "Error:: in send BLOB reply, should be send %d bytes, " |
| "really is %d\n", sizeof buf, ret); | "really is %d\n", sizeof buf, ret); |
| ret = -9; | ret = -9; |
| break; | break; |
| Line 408 rpc_srv_initBLOBServer(rpc_srv_t * __restrict srv, u_s | Line 410 rpc_srv_initBLOBServer(rpc_srv_t * __restrict srv, u_s |
| pthread_mutex_init(&srv->srv_blob.mtx, NULL); | pthread_mutex_init(&srv->srv_blob.mtx, NULL); |
| pthread_mutex_lock(&srv->srv_mtx); | |
| rpc_srv_registerCall(srv, NULL, CALL_BLOBSHUTDOWN, 0); | rpc_srv_registerCall(srv, NULL, CALL_BLOBSHUTDOWN, 0); |
| rpc_srv_registerCall(srv, NULL, CALL_BLOBCLIENTS, 0); | rpc_srv_registerCall(srv, NULL, CALL_BLOBCLIENTS, 1); |
| rpc_srv_registerCall(srv, NULL, CALL_BLOBVARS, 0); | rpc_srv_registerCall(srv, NULL, CALL_BLOBVARS, 1); |
| rpc_srv_registerCall(srv, NULL, CALL_BLOBSTATE, 1); | rpc_srv_registerCall(srv, NULL, CALL_BLOBSTATE, 0); |
| pthread_mutex_unlock(&srv->srv_mtx); | |
| srv->srv_blob.state = enable; /* enable BLOB */ | srv->srv_blob.state = enable; /* enable BLOB */ |
| return 0; | return 0; |
| Line 672 rpc_srv_initServer(u_int regProgID, u_int regProcID, i | Line 672 rpc_srv_initServer(u_int regProgID, u_int regProcID, i |
| pthread_mutex_init(&srv->srv_mtx, NULL); | pthread_mutex_init(&srv->srv_mtx, NULL); |
| rpc_srv_registerCall(srv, NULL, CALL_SRVSHUTDOWN, 0); | rpc_srv_registerCall(srv, NULL, CALL_SRVSHUTDOWN, 0); |
| rpc_srv_registerCall(srv, NULL, CALL_SRVCLIENTS, 0); | rpc_srv_registerCall(srv, NULL, CALL_SRVCLIENTS, 1); |
| rpc_srv_registerCall(srv, NULL, CALL_SRVCALLS, 0); | rpc_srv_registerCall(srv, NULL, CALL_SRVSESSIONS, 4); |
| rpc_srv_registerCall(srv, NULL, CALL_SRVSESSIONS, 0); | rpc_srv_registerCall(srv, NULL, CALL_SRVCALLS, 1); |
| return srv; | return srv; |
| } | } |