34,7 → 34,7 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
* |
* CVS : $Id: server-task.c,v 1.14 2004-12-17 13:19:42 trimarchi Exp $ |
* CVS : $Id: server-task.c,v 1.15 2005-01-18 15:04:52 trimarchi Exp $ |
*/ |
|
#include "ll/i386/64bit.h" |
50,11 → 50,13 |
//#define FSF_DEBUG |
extern fsf_server_id_t service_server; |
|
typedef enum {WAIT_SIGNAL, WAIT_RENEGOTIATION, ACTIVE} service_task_status; |
|
TASK service_task(void) { |
|
struct mess msg; |
fsf_renegotiation_status_t status; |
int wait_renegotiation=0; |
service_task_status stask_status=ACTIVE; |
|
PORT rec,tra; |
|
63,8 → 65,10 |
tra = port_connect("CHANR",sizeof(struct mess),STREAM,WRITE); |
|
while(1) { |
|
switch(stask_status) { |
// wait for operation |
if (wait_renegotiation) { |
case WAIT_RENEGOTIATION: |
if (!fsf_get_renegotiation_status(msg.server,&status)) { |
if (status==FSF_ADMITTED) { |
// send response server is -1 if the operation fail |
71,7 → 75,7 |
#ifdef FSF_DEBUG |
kern_printf("ADM"); |
#endif |
wait_renegotiation=0; |
stask_status=ACTIVE; |
//kern_printf("(REN %d)", msg.server); |
port_send(tra,&msg,BLOCK); |
|
82,7 → 86,19 |
#endif |
; |
} |
} else { |
break; |
|
case WAIT_SIGNAL: |
if (!fsf_get_renegotiation_status(msg.server,&status)) { |
if (status==FSF_ADMITTED) { |
sigqueue(msg.process, msg.sig_notify, msg.sig_value); |
stask_status=ACTIVE; |
} |
} |
break; |
|
case ACTIVE: |
{ |
port_receive(rec,&msg,BLOCK); |
#ifdef FSF_DEBUG |
kern_printf("Message "); |
93,7 → 109,7 |
if (negotiate_contract(&msg.contract, &msg.server)==FSF_ERR_CONTRACT_REJECTED) |
msg.server=-1; |
else { |
wait_renegotiation=1; |
stask_status=WAIT_RENEGOTIATION; |
//task_endcycle(); |
continue; |
} |
102,6 → 118,8 |
case REQUEST_RENEGOTIATE_CONTRACT: |
if (renegotiate_contract(&msg.contract, msg.server)==FSF_ERR_CONTRACT_REJECTED) |
msg.server=-1; |
else stask_status=WAIT_SIGNAL; |
|
break; |
|
case RENEGOTIATE_CONTRACT: |
108,7 → 126,7 |
if (renegotiate_contract(&msg.contract, msg.server)==FSF_ERR_CONTRACT_REJECTED) |
msg.server=-1; |
else { |
wait_renegotiation=1; |
stask_status=WAIT_RENEGOTIATION; |
//task_endcycle(); |
continue; |
} |
159,12 → 177,13 |
break; |
|
} |
|
break; |
} |
} |
port_send(tra,&msg,BLOCK); |
|
} |
} |
} |
|
|
static __inline void set_contract_parameter(void) { |