version 1.8.2.6, 2012/05/11 13:23:12
|
version 1.8.2.8, 2012/05/14 08:36:58
|
Line 94 txPacket(sched_task_t *task)
|
Line 94 txPacket(sched_task_t *task)
|
else if (ret != wlen) |
else if (ret != wlen) |
rpc_SetErr(EPROCUNAVAIL, "RPC reply, should be send %d bytes, " |
rpc_SetErr(EPROCUNAVAIL, "RPC reply, should be send %d bytes, " |
"really sended %d bytes", wlen, ret); |
"really sended %d bytes", wlen, ret); |
else |
|
ioDEBUG(RPC_DEBUG_LEVEL, "Sended %d bytes", ret); |
|
|
|
return NULL; |
return NULL; |
} |
} |
Line 131 execCall(sched_task_t *task)
|
Line 129 execCall(sched_task_t *task)
|
rpc->call_rep.ret = RPC_ERROR(-1); |
rpc->call_rep.ret = RPC_ERROR(-1); |
rpc->call_rep.eno = RPC_ERROR(rpc_Errno); |
rpc->call_rep.eno = RPC_ERROR(rpc_Errno); |
} else { |
} else { |
ioDEBUG(RPC_DEBUG_LEVEL, "RPC function %s from module %s", |
|
AIT_GET_STR(&f->func_name), AIT_GET_LIKE(&f->func_file, char*)); |
|
|
|
/* if client doesn't want reply */ |
/* if client doesn't want reply */ |
argc = rpc->call_req.flags & RPC_NOREPLY; |
argc = rpc->call_req.flags & RPC_NOREPLY; |
rpc->call_rep.ret = RPC_ERROR(rpc_srv_execCall(f, rpc, arr)); |
rpc->call_rep.ret = RPC_ERROR(rpc_srv_execCall(f, rpc, arr)); |
Line 171 rxPacket(sched_task_t *task)
|
Line 166 rxPacket(sched_task_t *task)
|
rlen = recv(TASK_FD(task), buf, TASK_DATLEN(task), 0); |
rlen = recv(TASK_FD(task), buf, TASK_DATLEN(task), 0); |
if (rlen == -1) { |
if (rlen == -1) { |
LOGERR; |
LOGERR; |
s->srv_kill = s->srv_blob.state = kill; | c->cli_kill = kill; |
return NULL; |
return NULL; |
} else if (!rlen) { /* receive EOF */ |
} else if (!rlen) { /* receive EOF */ |
s->srv_kill = s->srv_blob.state = kill; | c->cli_kill = kill; |
return NULL; |
return NULL; |
} else | } |
ioDEBUG(RPC_DEBUG_LEVEL, "Readed %d bytes", rlen); | |
|
|
do { |
do { |
if (rlen < sizeof(struct tagRPCCall)) { |
if (rlen < sizeof(struct tagRPCCall)) { |
Line 271 rpc_srv_dispatchCall(void *arg)
|
Line 265 rpc_srv_dispatchCall(void *arg)
|
|
|
schedRead(root, rxPacket, c, c->cli_sock, buf, s->srv_netbuf); |
schedRead(root, rxPacket, c, c->cli_sock, buf, s->srv_netbuf); |
|
|
schedRun(root, (void*) &s->srv_kill); | schedRun(root, (void*) &c->cli_kill); |
schedEnd(&root); |
schedEnd(&root); |
|
|
shutdown(c->cli_sock, SHUT_RDWR); |
shutdown(c->cli_sock, SHUT_RDWR); |
Line 300 txBLOB(sched_task_t *task)
|
Line 294 txBLOB(sched_task_t *task)
|
else if (wlen != sizeof(struct tagBLOBHdr)) |
else if (wlen != sizeof(struct tagBLOBHdr)) |
rpc_SetErr(EPROCUNAVAIL, "RPC reply, should be send %d bytes, " |
rpc_SetErr(EPROCUNAVAIL, "RPC reply, should be send %d bytes, " |
"really sended %d bytes", sizeof(struct tagBLOBHdr), wlen); |
"really sended %d bytes", sizeof(struct tagBLOBHdr), wlen); |
else |
|
ioDEBUG(RPC_DEBUG_LEVEL, "Sended %d bytes", wlen); |
|
|
|
return NULL; |
return NULL; |
} |
} |
Line 333 rxBLOB(sched_task_t *task)
|
Line 325 rxBLOB(sched_task_t *task)
|
rlen = recv(TASK_FD(task), buf, TASK_DATLEN(task), 0); |
rlen = recv(TASK_FD(task), buf, TASK_DATLEN(task), 0); |
if (rlen == -1) { |
if (rlen == -1) { |
LOGERR; |
LOGERR; |
s->srv_blob.state = kill; | c->cli_kill = kill; |
return NULL; |
return NULL; |
} else if (!rlen || s->srv_kill == kill) { /* receive EOF */ | } else if (!rlen) { /* receive EOF */ |
s->srv_blob.state = kill; | c->cli_kill = kill; |
return NULL; |
return NULL; |
} else | } |
ioDEBUG(RPC_DEBUG_LEVEL, "Readed %d bytes", rlen); | |
|
|
if (rlen < sizeof(struct tagBLOBHdr)) { |
if (rlen < sizeof(struct tagBLOBHdr)) { |
rpc_SetErr(ERPCMISMATCH, "Too short BLOB packet"); |
rpc_SetErr(ERPCMISMATCH, "Too short BLOB packet"); |
Line 457 rpc_srv_dispatchVars(void *arg)
|
Line 448 rpc_srv_dispatchVars(void *arg)
|
|
|
schedRead(root, rxBLOB, c, c->cli_sock, buf, sizeof(struct tagBLOBHdr)); |
schedRead(root, rxBLOB, c, c->cli_sock, buf, sizeof(struct tagBLOBHdr)); |
|
|
schedRun(root, (void*) &s->srv_blob.state); | schedRun(root, (void*) &c->cli_kill); |
schedEnd(&root); |
schedEnd(&root); |
|
|
shutdown(c->cli_sock, SHUT_RDWR); |
shutdown(c->cli_sock, SHUT_RDWR); |
Line 682 rpc_srv_loopBLOB(rpc_srv_t * __restrict srv)
|
Line 673 rpc_srv_loopBLOB(rpc_srv_t * __restrict srv)
|
c->cli_parent = srv; |
c->cli_parent = srv; |
|
|
/* spawn dispatch thread for BLOB client */ |
/* spawn dispatch thread for BLOB client */ |
|
c->cli_kill = enable; |
if (pthread_create(&c->cli_tid, &attr, rpc_srv_dispatchVars, c)) { |
if (pthread_create(&c->cli_tid, &attr, rpc_srv_dispatchVars, c)) { |
LOGERR; |
LOGERR; |
continue; |
continue; |
Line 904 rpc_srv_loopServer(rpc_srv_t * __restrict srv)
|
Line 896 rpc_srv_loopServer(rpc_srv_t * __restrict srv)
|
if (listen(srv->srv_server.cli_sock, SOMAXCONN) == -1) { |
if (listen(srv->srv_server.cli_sock, SOMAXCONN) == -1) { |
LOGERR; |
LOGERR; |
return -1; |
return -1; |
} /*else | } else |
fcntl(srv->srv_server.cli_sock, F_SETFL, fcntl(srv->srv_server.cli_sock, F_GETFL) | O_NONBLOCK); |
fcntl(srv->srv_server.cli_sock, F_SETFL, fcntl(srv->srv_server.cli_sock, F_GETFL) | O_NONBLOCK); |
*/ |
|
|
|
pthread_attr_init(&attr); |
pthread_attr_init(&attr); |
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
Line 943 rpc_srv_loopServer(rpc_srv_t * __restrict srv)
|
Line 934 rpc_srv_loopServer(rpc_srv_t * __restrict srv)
|
c->cli_parent = srv; |
c->cli_parent = srv; |
|
|
/* spawn rpc client dispatcher */ |
/* spawn rpc client dispatcher */ |
|
c->cli_kill = enable; |
if (pthread_create(&c->cli_tid, &attr, rpc_srv_dispatchCall, c)) { |
if (pthread_create(&c->cli_tid, &attr, rpc_srv_dispatchCall, c)) { |
LOGERR; |
LOGERR; |
continue; |
continue; |