Skip to content

Commit

Permalink
Merge pull request #41 from sy-c/master
Browse files Browse the repository at this point in the history
minor osx fix
  • Loading branch information
sy-c authored Aug 4, 2020
2 parents ff8de21 + f83d149 commit 6161dca
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/InfoLoggerClient.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
#include "InfoLoggerClient.h"
#include "infoLoggerDefaults.h"

#ifndef MSG_NOSIGNAL
#ifdef SO_NOSIGPIPE
#define MSG_NOSIGNAL SO_NOSIGPIPE
#else
#define MSG_NOSIGNAL 0
#endif
#endif
const int sendFlags = MSG_NOSIGNAL;

//////////////////////////////////////////////////////
// class ConfigInfoLoggerClient
// stores configuration params for infologgerD clients
Expand Down Expand Up @@ -213,8 +222,8 @@ int InfoLoggerClient::send(const char* message, unsigned int messageSize)
// so, clean it up if needed
reconnectThreadCleanup();

int flags = MSG_NOSIGNAL;
int bytesWritten = ::send(txSocket, message, messageSize, MSG_NOSIGNAL);

int bytesWritten = ::send(txSocket, message, messageSize, sendFlags);
if (bytesWritten == (int)messageSize) {
mutex.unlock();
return 0;
Expand Down Expand Up @@ -243,9 +252,8 @@ void InfoLoggerClient::reconnect() {
log.info("Reconnection successful");
int nFlushed = 0;
while(!messageBuffer.empty()) {
int flags = MSG_NOSIGNAL;
size_t messageSize = messageBuffer.front().size();
int bytesWritten = ::send(txSocket, messageBuffer.front().c_str(), messageSize, MSG_NOSIGNAL);
int bytesWritten = ::send(txSocket, messageBuffer.front().c_str(), messageSize, sendFlags);
if (bytesWritten == (int)messageSize) {
messageBuffer.pop();
nFlushed++;
Expand Down

0 comments on commit 6161dca

Please sign in to comment.