Hi Vu Ack
Thanks Lennart > -----Original Message----- > From: Vu Minh Nguyen [mailto:[email protected]] > Sent: den 8 mars 2017 10:36 > To: Lennart Lund <[email protected]>; [email protected]; > Canh Van Truong <[email protected]> > Cc: [email protected] > Subject: [PATCH 1 of 1] log: correct the LOG_NO message in unix socket > destination handler [#2355] > > src/log/logd/lgs_unixsock_dest.cc | 16 +++++++++++++--- > 1 files changed, 13 insertions(+), 3 deletions(-) > > > Correct the unclear syslog message and add comments in code > to explain why we need to resend the log record in case > the destination receiver is restarted somehow. > > diff --git a/src/log/logd/lgs_unixsock_dest.cc > b/src/log/logd/lgs_unixsock_dest.cc > --- a/src/log/logd/lgs_unixsock_dest.cc > +++ b/src/log/logd/lgs_unixsock_dest.cc > @@ -93,22 +93,32 @@ void UnixSocketHandler::FormRfc5424( > ErrCode UnixSocketHandler::Send(const DestinationHandler::RecordInfo& > msg) { > TRACE_ENTER(); > RfcBuffer buffer; > + ErrCode ret = ErrCode::kOk; > > FormRfc5424(msg, &buffer); > > ssize_t length = buffer.size(); > ssize_t len = sock_.Send(buffer.data(), length); > // Resend as probably receiver has just been restarted. > - // Retry only once, if not succesfully, leave it to upper layer decision. > + // If it is the case, the holding file descriptor could be invalid > + // and it will get failed to send log record to destination even the > receiver > + // is up already. If we do re-send once, the file descriptor will be renew > + // within the UnixSocket::Send() and probably get successful to send > + // log record to the destination. > if (len != length) { > - LOG_NO("Failed to send log record to socket destination. Resent."); > + TRACE("The receiver might be just restarted"); > len = sock_.Send(buffer.data(), length); > } > > FlushStatus(); > > + if (len != length) { > + LOG_NO("Failed to send log record to socket destination."); > + ret = ErrCode::kErr; > + } > + > TRACE_LEAVE(); > - return ((len != length) ? (ErrCode::kErr) : (ErrCode::kOk)); > + return ret; > } > > void UnixSocketHandler::Close() { ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
