Example #1
0
void	Stat_handle_message( sys_scatter *scat )
{
	sp_time		now;
	sp_time		delta;
	packet_header	*pack_ptr;
	proc		p;
	int		ret;

	pack_ptr = (packet_header *)scat->elements[0].buf;
	if( ! ( pack_ptr->memb_id.proc_id == 15051963 && Conf_id_in_conf( Conf_ref(), pack_ptr->proc_id ) != -1 ) )
	{
		Alarm( STATUS, "Stat_handle_message: Illegal monitor request\n");
		return;
	}

	now   = E_get_time();
	delta = E_sub_time( now, Start_time );
	GlobalStatus.sec = delta.sec;

	DL_send( Report_channel, pack_ptr->proc_id, pack_ptr->seq, &Report_scat );
	ret = Conf_proc_by_id( pack_ptr->proc_id, &p );
	if( ret < 0 )
		Alarm( STATUS, 
			"Stat_handle_message: sent status to Monitor at %d\n",
			pack_ptr->proc_id );
	else 	Alarm( STATUS, 
			"Stat_handle_message: sent status to Monitor at %s\n",
			p.name );
}
void	FC_handle_message( sys_scatter *scat )
{

	int16		*cur_fc_buf;
	packet_header	*pack_ptr;
	proc		dummy_proc;
	int		my_index;
	int16		temp_window,temp_personal_window;
        configuration   *Cn;

        Cn = Conf_ref();

	pack_ptr = (packet_header *)scat->elements[0].buf;
        if ( ! Conf_get_dangerous_monitor_state() ) {
                Alarm( FLOW_CONTROL, "FC_handle_message: Request to change flow control from (%d.%d.%d.%d) denied. Monitor in safe mode\n", IP1(pack_ptr->proc_id), IP2(pack_ptr->proc_id), IP3(pack_ptr->proc_id), IP4(pack_ptr->proc_id) );
                return;
        }

	if( ! ( pack_ptr->memb_id.proc_id == 15051963 && Conf_id_in_conf( Cn, pack_ptr->proc_id ) != -1 ) )
	{
		Alarm( FLOW_CONTROL, 
			"FC_handle_message: Illegal monitor request\n");
		return;
	}
	cur_fc_buf = (int16 *)scat->elements[1].buf;

	my_index = Conf_proc_by_id( Conf_my().id, &dummy_proc );

	if( Same_endian( pack_ptr->type ) ) {
		temp_window = cur_fc_buf[Conf_num_procs( Cn )];
		temp_personal_window = cur_fc_buf[my_index];
	}else{
		temp_window = Flip_int16( cur_fc_buf[Conf_num_procs( Cn )] );
		temp_personal_window = Flip_int16( cur_fc_buf[my_index] );
	}
	if( temp_window != -1 ) Window = temp_window;
	if( temp_personal_window != -1 ) Personal_window = temp_personal_window;
	GlobalStatus.window = Window;
	GlobalStatus.personal_window = Personal_window;
	Alarm( FLOW_CONTROL, 
		"FC_handle_message: Got monitor mess, Window %d Personal %d\n", 
			Window, Personal_window );
}
Example #3
0
/* Basic algorithm:
 * 1) have configuration code load new conf file and check for modifications to conf.
 * 2) If only add/sub of daemons, then initiate membership change with token_loss and return;
 * 3) else, then set Conf_reload_state, create singleton partition, and schedule token_loss.
 * 4) When membership completes in Discard_packets() cleanup partition and probe for new members.
 */
void    Prot_initiate_conf_reload( int code, void *data )
{
        bool    need_memb_partition;
        int16   singleton_partition[MAX_PROCS_RING];
        int     i;

        if (Memb_state() != OP ) {
            /* This is a race condition, that the Prot_initiate_conf_reload was scheduled when OP state, 
             * but another membership occured before it was executed.
             * The membership system will requeue this function when it reaches OP state again.
             */
            return;
        }
        /* Disable queueing of this function when OP state reached in membership */
        Prot_clear_need_conf_reload();

        need_memb_partition = Conf_reload_initiate();

        /* Signal all subsystems to update Conf and My strucures */
        Net_signal_conf_reload();
        Memb_signal_conf_reload();
        Sess_signal_conf_reload();

        /* update protocol varialbes with new conf */
        My = Conf_my();
	My_index = Conf_proc_by_id( My.id, &My );

        if (need_memb_partition) {
                /* make partition */
                for ( i = 0 ; i < Conf_num_procs( Conf_ref() ); i++ ) 
                {
                        singleton_partition[i] = i;
                }
                Net_set_partition(singleton_partition);

                Conf_reload_singleton_state_begin();
        }
        E_queue( Memb_token_loss, 0, NULL, Zero_timeout );
}