File: Logging_Event_Handler_Ex.cpp

package info (click to toggle)
ace 6.2.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 49,348 kB
  • ctags: 42,082
  • sloc: cpp: 342,284; perl: 32,718; ansic: 20,838; sh: 3,759; python: 828; exp: 787; yacc: 511; xml: 330; lex: 158; lisp: 116; makefile: 82; csh: 20; tcl: 5
file content (41 lines) | stat: -rw-r--r-- 1,171 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
** $Id: Logging_Event_Handler_Ex.cpp 91813 2010-09-17 07:52:52Z johnnyw $
**
** Copyright 2002 Addison Wesley. All Rights Reserved.
*/

#include "Logging_Event_Handler_Ex.h"
#include "ace/Timer_Queue.h"

int Logging_Event_Handler_Ex::handle_input (ACE_HANDLE h) {
  time_of_last_log_record_ =
    reactor ()->timer_queue ()->gettimeofday ();
  return PARENT::handle_input (h);
}

int Logging_Event_Handler_Ex::open () {
  int result = PARENT::open ();
  if (result != -1) {
    ACE_Time_Value reschedule (max_client_timeout_.sec () / 4);
    result =
      reactor ()->schedule_timer
        (this,
         0,
         max_client_timeout_,  // Initial timeout.
         reschedule);          // Subsequent timeouts.
  }
  return result;
}

int Logging_Event_Handler_Ex::handle_timeout
  (const ACE_Time_Value &now, const void *) {
  if (now - time_of_last_log_record_ >= max_client_timeout_)
    reactor ()->remove_handler (this, ACE_Event_Handler::READ_MASK);
  return 0;
}

int Logging_Event_Handler_Ex::handle_close (ACE_HANDLE,
                                            ACE_Reactor_Mask) {
  reactor ()->cancel_timer (this);
  return PARENT::handle_close ();
}