/shark/trunk/ports/first/server-task.c |
---|
34,7 → 34,7 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
* |
* CVS : $Id: server-task.c,v 1.2 2004-05-25 12:38:05 trimarchi Exp $ |
* CVS : $Id: server-task.c,v 1.3 2004-05-25 12:41:47 trimarchi Exp $ |
*/ |
#include "ll/i386/64bit.h" |
55,15 → 55,11 |
rec = port_connect("CHANW",sizeof(struct mess),STREAM,READ); |
cprintf("task start\n", rec); |
tra = port_connect("CHANR",sizeof(struct mess),STREAM,WRITE); |
cprintf("task start\n", tra); |
cprintf("Fine connect %d\n", rec); |
while(1) { |
// wait for renegotiation |
cprintf("(pr_t %d)",port_receive(rec,&message,BLOCK)); |
port_receive(rec,&message,BLOCK); |
switch (message.type) { |
case NEGOTIATE_CONTRACT: |
81,7 → 77,7 |
} |
// send response server is -1 if the operation fail |
cprintf("(ps_t %d)",port_send(tra,&message,BLOCK)); |
port_send(tra,&message,BLOCK); |
task_endcycle(); |
/shark/trunk/ports/first/first-server.c |
---|
51,14 → 51,11 |
void FSF_start_service_task(SOFT_TASK_MODEL *model) { |
// create the service task |
cprintf("Create Service Task\n"); |
// create the communication channel for negotiation and renegotiation |
channel[1] = port_create("CHANW",sizeof(struct mess),1,STREAM,WRITE); |
cprintf("(ch %d)", channel[1]); |
channel[0] = port_create("CHANR",sizeof(struct mess),1,STREAM,READ); |
cprintf("(ch %d)", channel[0]); |
server_task = task_create("stask",service_task,model,NULL); |
if (server_task == -1) { |
283,9 → 280,9 |
message.type=NEGOTIATE_CONTRACT; |
memmove(&message.contract,contract, sizeof(fsf_contract_parameters_t)); |
cprintf("(ps %d)",port_send(channel[1],&message,BLOCK)); |
port_send(channel[1],&message,BLOCK); |
cprintf("(pr %d)\n",port_receive(channel[0], &message, BLOCK)); |
port_receive(channel[0], &message, BLOCK); |
if (message.server==-1) |
return FSF_ERR_CONTRACT_REJECTED; |