Modifications to resolve issues found during self-code review.
This commit is contained in:
@@ -80,31 +80,41 @@ RemoteEndPoint::RemoteEndPoint(
|
||||
{
|
||||
DbgTrace(1, "RemoteEndPoint::RemoteEndPoint- Start, Obj = %0X\n", this);
|
||||
|
||||
// Initialize our mutex
|
||||
pthread_mutex_init(&m_mutex, NULL);
|
||||
// Verify that the specified path is not too long
|
||||
if (strlen(pSocketFileName) < sizeof(sizeof(m_serverUnAddr.sun_path)))
|
||||
{
|
||||
// Initialize our mutex
|
||||
pthread_mutex_init(&m_mutex, NULL);
|
||||
|
||||
// Set the necessary information in the m_serverUnAddr variable
|
||||
m_serverUnAddr.sun_family = AF_UNIX;
|
||||
strcpy(m_serverUnAddr.sun_path, pSocketFileName);
|
||||
// Set the necessary information in the m_serverUnAddr variable
|
||||
m_serverUnAddr.sun_family = AF_UNIX;
|
||||
strncpy(m_serverUnAddr.sun_path, pSocketFileName, sizeof(m_serverUnAddr.sun_path) - 1);
|
||||
|
||||
// Set the necessary flags to indicate that DOMAIN sockets
|
||||
// should be used for communications.
|
||||
m_Use_PF_UNIX = true;
|
||||
m_Use_AF_INET = false;
|
||||
// Set the necessary flags to indicate that DOMAIN sockets
|
||||
// should be used for communications.
|
||||
m_Use_PF_UNIX = true;
|
||||
m_Use_AF_INET = false;
|
||||
|
||||
// Setup the number of channels that we may have based on
|
||||
// whether the application is multi-threaded or not.
|
||||
if (multithreaded)
|
||||
m_numCChannels = MAX_CHANNELS_PER_ENDPOINT;
|
||||
// Setup the number of channels that we may have based on
|
||||
// whether the application is multi-threaded or not.
|
||||
if (multithreaded)
|
||||
m_numCChannels = MAX_CHANNELS_PER_ENDPOINT;
|
||||
else
|
||||
m_numCChannels = 1;
|
||||
|
||||
// Instantiate entries in SmartCChannel vector
|
||||
try {
|
||||
for (int i = 0; i < m_numCChannels; i++)
|
||||
m_cchannelVector.push_back(SmartCChannelPointer());
|
||||
} catch (...) {
|
||||
DbgTrace(0, "RemoteEndPoint::RemoteEndPoint- Exception caught while initializing the cchannelVector\n", 0);
|
||||
pthread_mutex_destroy(&m_mutex);
|
||||
throw bad_alloc();
|
||||
}
|
||||
}
|
||||
else
|
||||
m_numCChannels = 1;
|
||||
|
||||
// Instantiate entries in SmartCChannel vector
|
||||
try {
|
||||
for (int i = 0; i < m_numCChannels; i++)
|
||||
m_cchannelVector.push_back(SmartCChannelPointer());
|
||||
} catch (...) {
|
||||
DbgTrace(0, "RemoteEndPoint::RemoteEndPoint- Exception caught while initializing the cchannelVector\n", 0);
|
||||
{
|
||||
DbgTrace(0, "RemoteEndPoint::RemoteEndPoint- Socket file path name too long\n", 0);
|
||||
throw bad_alloc();
|
||||
}
|
||||
|
||||
@@ -166,6 +176,7 @@ RemoteEndPoint::RemoteEndPoint(
|
||||
m_cchannelVector.push_back(SmartCChannelPointer());
|
||||
} catch (...) {
|
||||
DbgTrace(0, "RemoteEndPoint::RemoteEndPoint- Exception caught while initializing the cchannelVector\n", 0);
|
||||
pthread_mutex_destroy(&m_mutex);
|
||||
throw bad_alloc();
|
||||
}
|
||||
|
||||
@@ -259,7 +270,7 @@ RemoteEndPoint::getCChannel(void)
|
||||
m_cchannelVector[channelSelector].setPointer(NULL);
|
||||
}
|
||||
|
||||
CChannel *pCChannel;
|
||||
CChannel *pCChannel = NULL;
|
||||
try {
|
||||
|
||||
// Use the appropriate server address when instantiating
|
||||
@@ -325,9 +336,9 @@ RemoteEndPoint::getCChannel(void)
|
||||
int
|
||||
RemoteEndPoint::submitReq(
|
||||
char *pClientData,
|
||||
int clientDataLen,
|
||||
int32_t clientDataLen,
|
||||
char **ppServerData,
|
||||
int *pServerDataLen)
|
||||
int32_t *pServerDataLen)
|
||||
//
|
||||
// Arguments:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user