Пример #1
0
/* Cancel timer.
 * Arguments:	tid - timer id
 */
void cancel_timer(TID tid)
{
        ABS_TIME at;
	sigset_t savemask;

	sigprocmask(SIG_BLOCK, &blockalrm, &savemask);	/* block SIGALRM signal */
	sys_get_curr_time(&at);
	if (tid == 0)
	{
		assert(process_exiting || IS_GTMSECSHR_IMAGE); /* wcs_phase2_commit_wait relies on this flag being set BEFORE
								* cancelling all timers. But secshr doesn't have it.
								*/
		cancel_all_timers();
		uninit_all_timers();
		timer_stack_count = 0;
		sigprocmask(SIG_SETMASK, &savemask, NULL);
		return;
	}
	if (timeroot && (timeroot->tid == tid))		/* if this is the first timer in the chain, stop it */
		sys_canc_timer();
	remove_timer(tid);		/* remove it from the chain */
	start_first_timer(&at);		/* start the first timer in the chain */
	sigprocmask(SIG_SETMASK, &savemask, NULL);
}
EAP_FUNC_EXPORT eap_status_e eap_wimax_authentication_c::shutdown()
{
  EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  
  EAP_TRACE_DEBUG
    (m_am_tools,
     TRACE_FLAGS_DEFAULT,
     (EAPL("partner calls: eap_wimax_authentication_c::shutdown(); %s, m_shutdown_was_called=%d\n"),
      (m_is_client == true) ? "client": "server",
      m_shutdown_was_called));

  EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eap_wimax_authentication_c::shutdown()\n");

  if (m_shutdown_was_called == true)
    {
      // Shutdown was already called once.
      return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
    }

  m_shutdown_was_called = true;
	
  // Cancel timers	
  cancel_all_timers();

  // Delete upper stack if it still exists
  if (m_eap_core != 0)
    {
      WAUTH_ENTER_MUTEX(m_am_tools);
      
      EAP_TRACE_DEBUG
	(m_am_tools,
	 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, 
	 (EAPL("calls eap: eap_wimax_authentication_c::shutdown(): m_eap_core->shutdown(): %s.\n"),
	  (m_is_client == true) ? "client": "server"));
      
      eap_status_e status = m_eap_core->shutdown();

      EAP_TRACE_DEBUG
	(m_am_tools,
	 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, 
	 (EAPL("returns from eap: eap_wimax_authentication_c::shutdown(): m_eap_core->shutdown(): %s, status = %s.\n"),
	  (m_is_client == true) ? "client": "server",
	  eap_status_string_c::get_status_string(status)));
      
      EAP_UNREFERENCED_PARAMETER(status); // in release
      
      WAUTH_LEAVE_MUTEX(m_am_tools);
      
      delete m_eap_core;
      m_eap_core = 0;
    }
	
  if (m_am_wauth != 0)
    {
      EAP_TRACE_DEBUG
		(m_am_tools,
		TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, 
		(EAPL("calls: eap_wimax_authentication_c::shutdown(): m_am_wauth->shutdown(): %s.\n"),
		(m_is_client == true) ? "client": "server"));
      
      m_am_wauth->shutdown();
      delete m_am_wauth;
      m_am_wauth = 0;
    }
  
  EAP_TRACE_DEBUG
    (m_am_tools,
	TRACE_FLAGS_DEFAULT,
    (EAPL("WAUTH EXITING.\n")));
  
  EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  return eap_status_ok;
}