This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch 3.6.x-rpm-debug in repository nx-libs. from 1526f9f Merge branch 'master' into 3.6.x-rpm-debug new 6e831f2 nxcomp/src/Log.h: use initializer lists instead of initializing member variables in-block. new 490e7bd nxcomp/src/Log.h: NXLogStamp constructor should actually take a size_t-typed line parameter. new 7c36d20 nxcomp/src/Log.{cpp,h}: provide infrastructure for appending to already existing log lines. new 9360c9f fixup new 6548155 nxcomp/src/Loop.cpp: whitespace only. new 4d046e4 nxcomp/src/Loop.cpp: use new log continuation mechanism. The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: nxcomp/src/Log.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- nxcomp/src/Log.h | 35 +++++++++++++++++------------------ nxcomp/src/Loop.cpp | 34 +++++++++++++++++----------------- 3 files changed, 79 insertions(+), 43 deletions(-) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch 3.6.x-rpm-debug in repository nx-libs. commit 6e831f2bf64a4e902f6a778aa47b67660d78bf1f Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 24 20:07:44 2017 +0100 nxcomp/src/Log.h: use initializer lists instead of initializing member variables in-block. --- nxcomp/src/Log.h | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/nxcomp/src/Log.h b/nxcomp/src/Log.h index 3e355a9..66d4d14 100644 --- a/nxcomp/src/Log.h +++ b/nxcomp/src/Log.h @@ -105,12 +105,8 @@ class NXLogStamp } - NXLogStamp(const char *file, const char *function, int line, NXLogLevel level) + NXLogStamp(const char *file, const char *function, int line, NXLogLevel level) : file_(file), function_(function), line_(line), level_(level) { - file_ = std::string(file); - function_ = std::string(function); - line_ = line; - level_ = level; gettimeofday(×tamp_, NULL); } @@ -273,18 +269,9 @@ class NXLog public: - NXLog() - { - stream_ = &std::cerr; - level_ = NXWARNING; - synchronized_ = true; - thread_buffer_size_ = 1024; - log_level_ = false; - log_time_ = false; - log_unix_time_ = false; - log_location_ = false; - log_thread_id_ = false; - + NXLog() : stream_(&std::cerr), level_(NXWARNING), synchronized_(true), thread_buffer_size_(1024), + log_level_(false), log_time_(false), log_unix_time_(false), log_location_(false), log_thread_id_(false) + { if ( pthread_key_create(&tls_key_, free_thread_data) != 0 ) { std::cerr << "pthread_key_create failed" << std::endl; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch 3.6.x-rpm-debug in repository nx-libs. commit 490e7bd202eef3d9b9918339270b5ff1efe11bfc Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 24 20:17:18 2017 +0100 nxcomp/src/Log.h: NXLogStamp constructor should actually take a size_t-typed line parameter. --- nxcomp/src/Log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nxcomp/src/Log.h b/nxcomp/src/Log.h index 66d4d14..6c4370c 100644 --- a/nxcomp/src/Log.h +++ b/nxcomp/src/Log.h @@ -105,7 +105,7 @@ class NXLogStamp } - NXLogStamp(const char *file, const char *function, int line, NXLogLevel level) : file_(file), function_(function), line_(line), level_(level) + NXLogStamp(const char *file, const char *function, size_t line, NXLogLevel level) : file_(file), function_(function), line_(line), level_(level) { gettimeofday(×tamp_, NULL); } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch 3.6.x-rpm-debug in repository nx-libs. commit 7c36d20c40ac730de1a764cc718373fb4a0af68b Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Dec 24 22:16:38 2017 +0100 nxcomp/src/Log.{cpp,h}: provide infrastructure for appending to already existing log lines. --- nxcomp/src/Log.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- nxcomp/src/Log.h | 16 ++++++++++++++-- 2 files changed, 59 insertions(+), 10 deletions(-) diff --git a/nxcomp/src/Log.cpp b/nxcomp/src/Log.cpp index 24f6605..05de09e 100644 --- a/nxcomp/src/Log.cpp +++ b/nxcomp/src/Log.cpp @@ -106,16 +106,53 @@ std::string NXLog::stamp_to_string(const NXLogStamp& stamp) const NXLog& operator<< (NXLog& out, const NXLogStamp& value) { - out.current_level( value.level() ); - out.current_file( value.file() ); + /* + * If appending, the file and function names must be empty and + * the line set to zero. + */ + const bool looks_like_append = ((value.file().empty()) || (value.function().empty()) || (0 == value.line())); + const bool append = ((looks_like_append) && ((value.file().empty()) && (value.function().empty()) && (0 == value.line()))); + + if ((looks_like_append) && (!append)) + { + std::cerr << "WARNING: At least one element in logstamp invalid, but this is not supposed to be an append operation." + << "Internal state error!\n" << "Log line will be discarded!" << std::endl; + } + else if (append) + { + /* Appending means that the log object's internal level and the message level must match. */ + if (out.current_level() == value.level()) + { + /* And the buffer must of course be non-empty. */ + if (out.has_buffer()) + { + out << "(cont.) "; + } + else + { + std::cerr << "WARNING: Append operation requested, but no queued data available." + << "Internal state error!\n" << "Log line will be discarded!" << std::endl; + } + } + else + { + std::cerr << "WARNING: Append operation requested, but internal log level not matching line level." + << "Internal state error!\n" << "Log line will be discarded!" << std::endl; + } + } + else + { + out.current_level( value.level() ); + out.current_file( value.file() ); - // Writing an NXLogStamp to the stream indicates the start of a new entry. - // If there's any content in the buffer and we actually intend to keep that line, - // create a new entry in the output queue. - if ( out.synchronized() && out.will_log() ) - out.new_stack_entry(); + // Writing an NXLogStamp to the stream indicates the start of a new entry. + // If there's any content in the buffer and we actually intend to keep that line, + // create a new entry in the output queue. + if ( out.synchronized() && out.will_log() ) + out.new_stack_entry(); - out << out.stamp_to_string(value); + out << out.stamp_to_string(value); + } return out; } diff --git a/nxcomp/src/Log.h b/nxcomp/src/Log.h index 6c4370c..a9410f2 100644 --- a/nxcomp/src/Log.h +++ b/nxcomp/src/Log.h @@ -105,7 +105,7 @@ class NXLogStamp } - NXLogStamp(const char *file, const char *function, size_t line, NXLogLevel level) : file_(file), function_(function), line_(line), level_(level) + NXLogStamp(const char *file = NULL, const char *function = NULL, size_t line = 0, NXLogLevel level) : file_(file), function_(function), line_(line), level_(level) { gettimeofday(×tamp_, NULL); } @@ -432,6 +432,11 @@ class NXLog */ bool will_log() const; + bool has_buffer() const + { + return (!(get_data()->buffer.empty ())); + } + /** * This catches std::flush @@ -466,7 +471,8 @@ class NXLog extern NXLog nx_log; -#define nxstamp(l) NXLogStamp(__FILE__, __func__, __LINE__, l) +#define nxstamp(l) NXLogStamp(__FILE__, __func__, __LINE__, l) +#define nxstamp_append(l) NXLogStamp(l) #define nxdbg nx_log << nxstamp(NXDEBUG) @@ -475,6 +481,12 @@ extern NXLog nx_log; #define nxerr nx_log << nxstamp(NXERROR) #define nxfatal nx_log << nxstamp(NXFATAL) +/* Append data to already existing (i.e., same-level) line. */ +#define nxdbg_append nx_log << nxstamp_append(NXDEBUG) +#define nxinfo_append nx_log << nxstamp_append(NXINFO) +#define nxwarn_append nx_log << nxstamp_append(NXWARNING) +#define nxerr_append nx_log << nxstamp_append(NXERROR) +#define nxfatal_append nx_log << nxstamp_append(NXFATAL) NXLog& operator<< (NXLog& out, const NXLogStamp& value); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch 3.6.x-rpm-debug in repository nx-libs. commit 9360c9f2b1634d336a7ad70b7f42b84539b315ab Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Dec 25 02:18:04 2017 +0100 fixup --- nxcomp/src/Log.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nxcomp/src/Log.cpp b/nxcomp/src/Log.cpp index 05de09e..a3a7222 100644 --- a/nxcomp/src/Log.cpp +++ b/nxcomp/src/Log.cpp @@ -115,7 +115,7 @@ NXLog& operator<< (NXLog& out, const NXLogStamp& value) if ((looks_like_append) && (!append)) { - std::cerr << "WARNING: At least one element in logstamp invalid, but this is not supposed to be an append operation." + std::cerr << "WARNING: At least one element in logstamp invalid, but this is not supposed to be an append operation. " << "Internal state error!\n" << "Log line will be discarded!" << std::endl; } else if (append) @@ -126,17 +126,17 @@ NXLog& operator<< (NXLog& out, const NXLogStamp& value) /* And the buffer must of course be non-empty. */ if (out.has_buffer()) { - out << "(cont.) "; + out << " (cont.) "; } else { - std::cerr << "WARNING: Append operation requested, but no queued data available." + std::cerr << "WARNING: Append operation requested, but no queued data available. " << "Internal state error!\n" << "Log line will be discarded!" << std::endl; } } else { - std::cerr << "WARNING: Append operation requested, but internal log level not matching line level." + std::cerr << "WARNING: Append operation requested, but internal log level not matching line level. " << "Internal state error!\n" << "Log line will be discarded!" << std::endl; } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch 3.6.x-rpm-debug in repository nx-libs. commit 65481550d51fc922309d14a7588c63caf7ee0e83 Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Dec 25 02:18:46 2017 +0100 nxcomp/src/Loop.cpp: whitespace only. --- nxcomp/src/Loop.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp index d05c229..b886154 100644 --- a/nxcomp/src/Loop.cpp +++ b/nxcomp/src/Loop.cpp @@ -6262,7 +6262,7 @@ int WaitForRemote(ChannelEndPoint &socketAddress) continue; } - + nxfatal << "Loop: PANIC! Call to select failed. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; @@ -6340,7 +6340,7 @@ int WaitForRemote(ChannelEndPoint &socketAddress) cerr << "Warning" << ": Refusing connection from '" << connectedHost << "'.\n"; - } + } // // Not the best way to elude a DOS attack... @@ -10860,7 +10860,7 @@ int SetLogs() S_IWGRP | S_IROTH | S_IWOTH); #endif - + if (OpenLogFile(errorsFileName, logofs) < 0) { HandleCleanup(); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch 3.6.x-rpm-debug in repository nx-libs. commit 4d046e44f9396720fc895bf780d0cbb7314a3c2b Author: Mihai Moldovan <ionic@ionic.de> Date: Mon Dec 25 02:19:17 2017 +0100 nxcomp/src/Loop.cpp: use new log continuation mechanism. Should fix messages queuing up indefinitely (until they are discarded at program termination, at least) and missing messages in general. Fixes: ArcticaProject/nx-libs#577 Fixes: ArcticaProject/nx-libs#611 --- nxcomp/src/Loop.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp index b886154..436250e 100644 --- a/nxcomp/src/Loop.cpp +++ b/nxcomp/src/Loop.cpp @@ -13449,12 +13449,12 @@ int ParseArg(const char *type, const char *name, const char *value) case 'm': case 'g': { - nxinfo << (char) toupper(*id); + nxinfo_append << (char) toupper(*id); break; } } - nxinfo << ".\n" << std::flush; + nxinfo_append << ".\n" << std::flush; double result = atof(string) * base; @@ -14034,7 +14034,7 @@ static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, { if (FD_ISSET(j, &readSet)) { - nxinfo << "[" << j << "]" << std::flush; + nxinfo_append << "[" << j << "]" << std::flush; i++; } @@ -14042,11 +14042,11 @@ static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, if (i > 0) { - nxinfo << ".\n" << std::flush; + nxinfo_append << ".\n" << std::flush; } else { - nxinfo << "[none].\n" << std::flush; + nxinfo_append << "[none].\n" << std::flush; } i = 0; @@ -14057,7 +14057,7 @@ static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, { if (FD_ISSET(j, &writeSet)) { - nxinfo << "[" << j << "]" << std::flush; + nxinfo_append << "[" << j << "]" << std::flush; i++; } @@ -14065,11 +14065,11 @@ static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, if (i > 0) { - nxinfo << ".\n" << std::flush; + nxinfo_append << ".\n" << std::flush; } else { - nxinfo << "[none].\n" << std::flush; + nxinfo_append << "[none].\n" << std::flush; } } @@ -14115,7 +14115,7 @@ static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, { if (FD_ISSET(j, &readSet)) { - nxinfo << "[" << j << "]" << std::flush; + nxinfo_append << "[" << j << "]" << std::flush; i++; } @@ -14123,11 +14123,11 @@ static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, if (i > 0) { - nxinfo << ".\n" << std::flush; + nxinfo_append << ".\n" << std::flush; } else { - nxinfo << "[none].\n" << std::flush; + nxinfo_append << "[none].\n" << std::flush; } i = 0; @@ -14138,7 +14138,7 @@ static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, { if (FD_ISSET(j, &writeSet)) { - nxinfo << "[" << j << "]" << std::flush; + nxinfo_append << "[" << j << "]" << std::flush; i++; } @@ -14146,11 +14146,11 @@ static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, if (i > 0) { - nxinfo << ".\n" << std::flush; + nxinfo_append << ".\n" << std::flush; } else { - nxinfo << "[none].\n" << std::flush; + nxinfo_append << "[none].\n" << std::flush; } } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git