34,7 → 34,7 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
* |
* CVS : $Id: server-task.c,v 1.12 2004-11-24 10:24:43 trimarchi Exp $ |
* CVS : $Id: server-task.c,v 1.13 2004-12-09 10:27:08 trimarchi Exp $ |
*/ |
|
#include "ll/i386/64bit.h" |
55,9 → 55,11 |
struct mess msg; |
fsf_renegotiation_status_t status; |
int wait_renegotiation=0; |
/* |
struct timespec next_act; |
struct timespec period; |
struct timespec act_time; |
*/ |
PORT rec,tra; |
|
rec = port_connect("CHANW",sizeof(struct mess),STREAM,READ); |
74,6 → 76,7 |
kern_printf("ADM"); |
#endif |
wait_renegotiation=0; |
//kern_printf("(REN %d)", msg.server); |
port_send(tra,&msg,BLOCK); |
//kern_gettime(&act_time); |
//fsf_get_budget_and_period(service_server,NULL,&period); |
117,8 → 120,46 |
continue; |
} |
break; |
case CHANGE_PARAMETER: |
// this CASE change the quality and importance |
case CHANGE_PARAMETER: |
{ |
fsf_contract_parameters_t new_contract; |
struct timespec period; |
struct timespec budget; |
int i=0; |
// this CASE change the quality and importance |
//fsf_initialize_contract(&new_contract); |
// find contract |
while(i<current_server) { |
if (server_list[i].server==msg.server) break; |
i++; |
} |
//kern_printf("(RCQI)"); |
NULL_TIMESPEC(&period); |
ADDUSEC2TIMESPEC(server_list[i].Tmax, &period); |
NULL_TIMESPEC(&budget); |
ADDUSEC2TIMESPEC(server_list[i].Cmin, &budget); |
|
fsf_set_contract_basic_parameters(&new_contract,&budget,&period,FSF_DEFAULT_WORKLOAD); |
NULL_TIMESPEC(&period); |
ADDUSEC2TIMESPEC(server_list[i].Tmin, &period); |
NULL_TIMESPEC(&budget); |
ADDUSEC2TIMESPEC(server_list[i].Cmax, &budget); |
|
fsf_set_contract_reclamation_parameters(&new_contract, &budget, &period, FSF_DEFAULT_GRANULARITY,NULL, |
msg.qi.quality,msg.qi.importance); |
|
if (server_list[i].d_equals_t == true) { |
NULL_TIMESPEC(&new_contract.deadline); |
new_contract.d_equals_t = true; |
} else { |
NULL_TIMESPEC(&period); |
ADDUSEC2TIMESPEC(server_list[i].deadline, &period); |
TIMESPEC_ASSIGN(&new_contract.deadline, &period); |
new_contract.d_equals_t = false; |
} |
if (renegotiate_contract(&new_contract, msg.server)==FSF_ERR_CONTRACT_REJECTED) |
msg.server=-1; |
} |
break; |
|
default : |
126,6 → 167,7 |
|
} |
// send response server is -1 if the operation fail |
//kern_printf("(msg server %d)", msg.server); |
port_send(tra,&msg,BLOCK); |
//kern_gettime(&act_time); |
//fsf_get_budget_and_period(service_server,NULL,&period); |
151,7 → 193,7 |
#ifdef FSF_DEBUG |
kern_printf("(1 - Q %ld T %ld)", server_list[i].actual_budget, server_list[i].actual_period); |
#endif |
if (server_list[i].d_equals_t == false) |
if (server_list[i].d_equals_t == true) |
adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, T, T); |
else |
adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, T, server_list[i].deadline); |
164,7 → 206,7 |
kern_printf("(2 - Q %ld T %ld)", server_list[i].actual_budget, server_list[i].actual_period); |
#endif |
|
if (server_list[i].d_equals_t == false) |
if (server_list[i].d_equals_t == true) |
adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, server_list[i].Tmin, server_list[i].Tmin); |
else |
adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, server_list[i].Tmin, server_list[i].deadline); |