EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AlertService Class Reference

#include "AlertService.h"

Inheritance diagram for AlertService:
Collaboration diagram for AlertService:

Public Member Functions

 AlertService (PyServiceMgr *mgr)
 
virtual ~AlertService ()
 
- Public Member Functions inherited from PyService
 PyService (PyServiceMgr *mgr, const char *serviceName)
 
virtual ~PyService ()
 
virtual PyResult Call (const std::string &method, PyCallArgs &args)
 
const char * GetName () const
 
- Public Member Functions inherited from PyCallable
 PyCallable ()
 
virtual ~PyCallable ()
 

Protected Member Functions

PyResult Handle_BeanCount (PyCallArgs &call)
 
PyResult Handle_BeanDelivery (PyCallArgs &call)
 
PyResult Handle_GroupBeanDelivery (PyCallArgs &call)
 
PyResult Handle_SendClientStackTraceAlert (PyCallArgs &call)
 The client sends us a python stack trace, from which we could make up what we did wrong. More...
 
- Protected Member Functions inherited from PyService
PyObject_BuildCachedReturn (PySubStream **result, const char *sessionInfo, CacheCheckTime check)
 
virtual PyBoundObjectCreateBoundObject (Client *pClient, const PyRep *bind_args)
 
virtual PyResult Handle_MachoResolveObject (PyCallArgs &call)
 
virtual PyResult Handle_MachoBindObject (PyCallArgs &call)
 
- Protected Member Functions inherited from PyCallable
void _SetCallDispatcher (CallDispatcher *d)
 

Protected Attributes

Dispatcher *const m_dispatch
 
PyTraceLogtraceLogger
 
- Protected Attributes inherited from PyService
PyServiceMgr *const m_manager
 

Additional Inherited Members

- Protected Types inherited from PyService
enum  CacheCheckTime {
  check_Always = 0, check_Never, check_in_year, check_in_6_months,
  check_in_3_months, check_in_1_month, check_in_1_week, check_in_1_day,
  check_in_12_hours, check_in_6_hours, check_in_3_hours, check_in_2_hours,
  check_in_1_hour, check_in_30_minutes, check_in_15_minutes, check_in_5_minutes,
  check_in_1_minute, check_in_30_seconds, check_in_15_seconds, check_in_5_seconds,
  check_in_1_second, _checkCount
}
 
- Static Protected Attributes inherited from PyService
static const char *const s_checkTimeStrings [_checkCount]
 

Detailed Description

Definition at line 33 of file AlertService.h.

Constructor & Destructor Documentation

AlertService::AlertService ( PyServiceMgr mgr)
AlertService::~AlertService ( )
virtual

Definition at line 50 of file AlertService.cpp.

References m_dispatch, SafeDelete(), and traceLogger.

51 {
52  delete m_dispatch;
54 }
Dispatcher *const m_dispatch
Definition: AlertService.h:39
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
PyTraceLog * traceLogger
Definition: AlertService.h:48

Here is the call graph for this function:

Member Function Documentation

PyResult AlertService::Handle_BeanCount ( PyCallArgs call)
protected

Basically BeanCount means that a error has occurred in the client python code, and it asks the server how to handle it. : in normal operations we should send back a unique mErrorID to the client, it saves it and sends the stack traces to us through BeanDelivery every 15 minutes. When we are in developer mode we should send back PyNone asking the to send us the stack trace immediately.

Definition at line 62 of file AlertService.cpp.

References _log, PyStatic, sConfig, PyTuple::size(), and PyCallArgs::tuple.

Referenced by PyCallable_Make_InnerDispatcher().

62  {
63  _log(CLIENT__WARNING, "AlertService::Handle_BeanCount(): size=%u", call.tuple->size() );
64  //call.Dump(CLIENT__CALL_DUMP);
65 
66  PyTuple *result = new PyTuple(2);
67 
68  // what we are sending back is just a static mErrorID and the command not to do anything with it.
69  if (sConfig.debug.BeanCount or sConfig.debug.IsTestServer) {
70  result->items[0] = PyStatic.NewNone();
71  } else {
72  result->items[0] = new PyInt(34135); //ErrorID
73  }
74 
75  result->items[1] = new PyInt(0); //loggingMode, 0=local, 1=DB (Capt: This isn't correct at all as it seems..)
76 
77  return (PyRep*)result;
78 }
Base Python wire object.
Definition: PyRep.h:66
#define sConfig
A macro for easier access to the singleton.
#define _log(type, fmt,...)
Definition: logsys.h:124
size_t size() const
Definition: PyRep.h:591
Python tuple.
Definition: PyRep.h:567
Python integer.
Definition: PyRep.h:231
#define PyStatic
Definition: PyRep.h:1209
PyTuple * tuple
Definition: PyCallable.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

PyResult AlertService::Handle_BeanDelivery ( PyCallArgs call)
protected

The client "stacks" up the python "stack" traces and sends them every 15 minutes. : this process is only useful when we supply the client with a valid mErrorID. meaning that we should code a mErrorID tracker for it. To handle these.

Definition at line 85 of file AlertService.cpp.

References _log, PyStatic, PyTuple::size(), and PyCallArgs::tuple.

Referenced by PyCallable_Make_InnerDispatcher().

86 {
87  _log(CLIENT__WARNING, "AlertService::Handle_BeanDelivery(): size=%u", call.tuple->size() );
88  //call.Dump(CLIENT__CALL_DUMP);
89  /* Unhandled for now as we have no interest in receiving batched python stack traces
90  * nor official style debugging... Just gimme the info dude (see Handle_SendClientStackTraceAlert).
91  */
92  return PyStatic.NewNone();
93 }
#define _log(type, fmt,...)
Definition: logsys.h:124
size_t size() const
Definition: PyRep.h:591
#define PyStatic
Definition: PyRep.h:1209
PyTuple * tuple
Definition: PyCallable.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

PyResult AlertService::Handle_GroupBeanDelivery ( PyCallArgs call)
protected

Definition at line 95 of file AlertService.cpp.

References _log, PyStatic, PyTuple::size(), and PyCallArgs::tuple.

Referenced by PyCallable_Make_InnerDispatcher().

96 {
97  _log(CLIENT__WARNING, "AlertService::Handle_GroupBeanDelivery(): size=%u", call.tuple->size() );
98  //call.Dump(CLIENT__CALL_DUMP);
99 
100  return PyStatic.NewNone();
101 }
#define _log(type, fmt,...)
Definition: logsys.h:124
size_t size() const
Definition: PyRep.h:591
#define PyStatic
Definition: PyRep.h:1209
PyTuple * tuple
Definition: PyCallable.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

PyResult AlertService::Handle_SendClientStackTraceAlert ( PyCallArgs call)
protected

The client sends us a python stack trace, from which we could make up what we did wrong.

Parameters
[in]callis the python packet that contains the info for this function
Note
I'm sending PyNone back, this is just a wild guess. I don't know its actually required. function is part of a system that allows us to ask the client to send the trace directly, and skip the BeanDelivery system.
Returns
guess it should have PyNone back.

Definition at line 113 of file AlertService.cpp.

References _log, is_log_enabled, PyTraceLog::logTrace(), PyStatic, sConfig, PyTuple::size(), traceLogger, and PyCallArgs::tuple.

Referenced by PyCallable_Make_InnerDispatcher().

113  {
114  _log(CLIENT__WARNING, "AlertService::Handle_SendClientStackTraceAlert(): size=%u", call.tuple->size() );
115  //call.Dump(CLIENT__CALL_DUMP);
116  // self.stacktraceLogMode[stackID[0]] = sm.ProxySvc('alert').SendClientStackTraceAlert(stackID, stackTrace, mode, nextErrorKeyHash)
117 
118  if (sConfig.debug.StackTrace or is_log_enabled(CLIENT__STACK_TRACE))
119  traceLogger->logTrace(*call.tuple);
120 
121  return PyStatic.NewNone();
122 }
#define sConfig
A macro for easier access to the singleton.
#define _log(type, fmt,...)
Definition: logsys.h:124
size_t size() const
Definition: PyRep.h:591
#define is_log_enabled(type)
Definition: logsys.h:78
PyTraceLog * traceLogger
Definition: AlertService.h:48
#define PyStatic
Definition: PyRep.h:1209
bool logTrace(PyTuple &tuple)
logTrace is the function what its all about.
Definition: PyTraceLog.h:133
PyTuple * tuple
Definition: PyCallable.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Dispatcher* const AlertService::m_dispatch
protected

Definition at line 39 of file AlertService.h.

Referenced by ~AlertService().

PyTraceLog* AlertService::traceLogger
protected

Definition at line 48 of file AlertService.h.

Referenced by Handle_SendClientStackTraceAlert(), and ~AlertService().


The documentation for this class was generated from the following files: