diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-02-17 11:52:35 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-02-17 11:52:35 +0000 |
commit | b2c19b166a580885f860e2591d964104f8d5c89a (patch) | |
tree | a1fe1cf9793d3774cfdfb89ec9eaefcc9ba90e7e /ACE/netsvcs | |
parent | 069bd041e6073e90250d9403a3ed61d606c744c5 (diff) | |
download | ATCD-b2c19b166a580885f860e2591d964104f8d5c89a.tar.gz |
Tue Feb 17 11:52:28 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* netsvcs/lib/Client_Logging_Handler.cpp:
* netsvcs/lib/Client_Logging_Handler.h:
Added new ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES which
can be explicitly set to 0 to just use sockets
Diffstat (limited to 'ACE/netsvcs')
-rw-r--r-- | ACE/netsvcs/lib/Client_Logging_Handler.cpp | 18 | ||||
-rw-r--r-- | ACE/netsvcs/lib/Client_Logging_Handler.h | 12 |
2 files changed, 20 insertions, 10 deletions
diff --git a/ACE/netsvcs/lib/Client_Logging_Handler.cpp b/ACE/netsvcs/lib/Client_Logging_Handler.cpp index 76e3becb70e..c3b4b1af3ed 100644 --- a/ACE/netsvcs/lib/Client_Logging_Handler.cpp +++ b/ACE/netsvcs/lib/Client_Logging_Handler.cpp @@ -121,7 +121,7 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle) // Align the Message Block for a CDR stream ACE_CDR::mb_align (header.get ()); -#if defined (ACE_HAS_STREAM_PIPES) +#if (ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES == 1) // We're getting a logging message from a local application using // STREAM pipes, which are nicely prioritized for us. ACE_Str_Buf header_msg (header->wr_ptr (), @@ -137,7 +137,7 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle) (ACE_Str_Buf *) 0, &flags); - if (result < 0 || header_msg.len != length) + if (result < 0 || header_msg.len == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client closing down unexpectedly\n"))); @@ -191,7 +191,7 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle) // Just fall through in this case.. break; } -#endif /* ACE_HAS_STREAM_PIPES */ +#endif /* ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES == 1 */ // Reflect addition of 8 bytes for the header. header->wr_ptr (8); @@ -229,7 +229,7 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle) // Ensure there's sufficient room for log record payload. ACE_CDR::grow (payload.get (), 8 + ACE_CDR::MAX_ALIGNMENT + length); -#if defined (ACE_HAS_STREAM_PIPES) +#if (ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES == 1) ACE_Str_Buf payload_msg (payload->wr_ptr (), 0, length); @@ -251,7 +251,9 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle) | ACE_Event_Handler::EXCEPT_MASK | ACE_Event_Handler::DONT_CALL) == -1) ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%n: %p\n"), + ACE_TEXT ("%n: result %d, length %d %p\n"), + result, + payload_msg.len ACE_TEXT ("remove_handler")), -1); spipe.close (); @@ -277,7 +279,7 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle) ACE_OS::closesocket (handle); return 0; } -#endif /* ACE_HAS_STREAM_PIPES */ +#endif /* ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES == 1 */ // Reflect additional bytes for the message. payload->wr_ptr (length); @@ -563,7 +565,7 @@ ACE_Client_Logging_Acceptor::init (int argc, ACE_TCHAR *argv[]) ACE_SOCK_Stream stream; ACE_INET_Addr server_addr; -#if defined (ACE_HAS_STREAM_PIPES) +#if (ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES == 1) ACE_SPIPE_Addr lserver_addr; // Figure out what local port we're really bound to. @@ -593,7 +595,7 @@ ACE_Client_Logging_Acceptor::init (int argc, ACE_TCHAR *argv[]) ACE_TEXT ("bounded to local port %d on handle %u\n"), lserver_addr.get_port_number (), this->acceptor ().get_handle ())); -#endif /* ACE_HAS_STREAM_PIPES */ +#endif /* ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES == 1 */ if (con.connect (stream, this->server_addr_, diff --git a/ACE/netsvcs/lib/Client_Logging_Handler.h b/ACE/netsvcs/lib/Client_Logging_Handler.h index 9cf8b88477f..7263b659946 100644 --- a/ACE/netsvcs/lib/Client_Logging_Handler.h +++ b/ACE/netsvcs/lib/Client_Logging_Handler.h @@ -24,7 +24,15 @@ #include "ace/Svc_Handler.h" #include "svc_export.h" +#if !defined (ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES) #if defined (ACE_HAS_STREAM_PIPES) +# define ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES 1 +#else +# define ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES 0 +#endif /* ACE_HAS_STREAM_PIPES */ +#endif + +#if (ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES == 1) #define LOGGING_STREAM ACE_SPIPE_STREAM #define LOGGING_ACCEPTOR ACE_SPIPE_ACCEPTOR #define LOGGING_ADDR ACE_SPIPE_Addr @@ -32,7 +40,7 @@ #define LOGGING_STREAM ACE_SOCK_STREAM #define LOGGING_ACCEPTOR ACE_SOCK_ACCEPTOR #define LOGGING_ADDR ACE_INET_Addr -#endif /* ACE_HAS_STREAM_PIPES */ +#endif /* ACE_NETSVCS_CLIENT_LOGGING_HANDLER_USES_STREAM_PIPES == 1 */ #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Svc_Export ACE_Svc_Handler<LOGGING_STREAM, ACE_NULL_SYNCH>; @@ -84,7 +92,7 @@ private: * Receive logging records from applications. This is necessary to * handle madness with UNIX select, which can't deal with MSG_BAND * data easily due to its overly simple interface... This just - * calls <handle_input>. + * calls handle_input(). */ virtual int handle_exception (ACE_HANDLE); |