fixed binding to specified interface (broken by R3.14 beta changes)
This commit is contained in:
@@ -35,10 +35,6 @@ epicsShareFunc caServer::caServer ()
|
||||
}
|
||||
|
||||
this->pCAS = new caServerI(*this);
|
||||
if (this->pCAS==NULL) {
|
||||
errMessage (S_cas_noMemory, " - unable to create caServer");
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -79,8 +79,9 @@ caServerI::caServerI (caServer &tool) :
|
||||
this->locateInterfaces ();
|
||||
|
||||
if (this->intfList.count()==0u) {
|
||||
errMessage (S_cas_noInterface, "CA server internals init");
|
||||
return;
|
||||
errMessage (S_cas_noInterface,
|
||||
"- CA server internals init unable to continue");
|
||||
throw S_cas_noInterface;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -100,15 +100,7 @@ casEventMask casEventRegistry::registerEvent(const char *pName)
|
||||
}
|
||||
else {
|
||||
pEntry = new casEventMaskEntry(*this, mask, pName);
|
||||
if (pEntry) {
|
||||
mask = *pEntry;
|
||||
}
|
||||
else {
|
||||
mask.mask = 0u;
|
||||
errMessage(S_cas_noMemory,
|
||||
"mask bit was lost during init");
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
mask = *pEntry;
|
||||
}
|
||||
}
|
||||
return mask;
|
||||
|
||||
@@ -37,20 +37,17 @@ static const caHdr nill_msg = {0u,0u,0u,0u,0u,0u};
|
||||
casStrmClient::casStrmClient ( caServerI &serverInternal ) :
|
||||
casClient ( serverInternal, 1 )
|
||||
{
|
||||
this->pHostName = new char [1u];
|
||||
*this->pHostName = '\0';
|
||||
|
||||
this->lock ();
|
||||
|
||||
this->ctx.getServer()->installClient ( this );
|
||||
|
||||
this->pHostName = new char [1u];
|
||||
if ( ! this->pHostName ) {
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
*this->pHostName = '\0';
|
||||
|
||||
this->pUserName = new char [1u];
|
||||
this->pUserName = new ( std::nothrow ) char [1u];
|
||||
if ( ! this->pUserName ) {
|
||||
free ( this->pHostName );
|
||||
throw S_cas_noMemory;
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
*this->pUserName= '\0';
|
||||
|
||||
|
||||
@@ -54,9 +54,6 @@ casBeaconTimer::~casBeaconTimer ()
|
||||
caServerOS::caServerOS ()
|
||||
{
|
||||
this->pBTmr = new casBeaconTimer(0.0, *this);
|
||||
if (!this->pBTmr) {
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -219,17 +219,9 @@ void casDGIntfOS::armRecv()
|
||||
if ( ! this->in.full () ) {
|
||||
if (!this->pRdReg) {
|
||||
this->pRdReg = new casDGReadReg(*this);
|
||||
if (!this->pRdReg) {
|
||||
errMessage (S_cas_noMemory, "armRecv()");
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
}
|
||||
if (this->validBCastFD() && this->pBCastRdReg==NULL) {
|
||||
this->pBCastRdReg = new casDGBCastReadReg(*this);
|
||||
if (!this->pBCastRdReg) {
|
||||
errMessage (S_cas_noMemory, "armRecv()");
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,10 +250,6 @@ void casDGIntfOS::armSend()
|
||||
|
||||
if (!this->pWtReg) {
|
||||
this->pWtReg = new casDGWriteReg(*this);
|
||||
if (!this->pWtReg) {
|
||||
errMessage (S_cas_noMemory, "armSend()");
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,11 +49,6 @@ casIntfOS::casIntfOS (caServerI &casIn, const caNetAddr &addrIn,
|
||||
this->setNonBlocking();
|
||||
|
||||
this->pRdReg = new casServerReg(*this);
|
||||
if (this->pRdReg==NULL) {
|
||||
errMessage (S_cas_noMemory,
|
||||
"casIntfOS::casIntfOS()");
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -256,10 +256,6 @@ inline void casStreamOS::armRecv()
|
||||
if ( ! this->pRdReg ) {
|
||||
if ( ! this->in.full() ) {
|
||||
this->pRdReg = new casStreamReadReg ( *this );
|
||||
if ( ! this->pRdReg ) {
|
||||
errMessage ( S_cas_noMemory, "armRecv()" );
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,10 +281,6 @@ inline void casStreamOS::armSend()
|
||||
|
||||
if ( ! this->pWtReg ) {
|
||||
this->pWtReg = new casStreamWriteReg(*this);
|
||||
if (!this->pWtReg) {
|
||||
errMessage(S_cas_noMemory, "armSend() failed");
|
||||
throw S_cas_noMemory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,6 @@ void caServerIO::locateInterfaces ()
|
||||
}
|
||||
|
||||
memset ((char *)&saddr,0,sizeof(saddr));
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_port = ntohs (port);
|
||||
|
||||
pStr = envGetConfigParam(&EPICS_CA_AUTO_ADDR_LIST, sizeof(buf), buf);
|
||||
if (pStr) {
|
||||
@@ -98,7 +96,7 @@ void caServerIO::locateInterfaces ()
|
||||
while ( (pToken = getToken(&pStr, buf, sizeof(buf))) ) {
|
||||
int status;
|
||||
|
||||
status = aToIPAddr (pToken, 0u, &saddr);
|
||||
status = aToIPAddr (pToken, port, &saddr);
|
||||
if (status) {
|
||||
errlogPrintf(
|
||||
"%s: Parsing '%s'\n",
|
||||
@@ -118,6 +116,8 @@ void caServerIO::locateInterfaces ()
|
||||
}
|
||||
}
|
||||
else {
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_port = ntohs (port);
|
||||
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
stat = this->attachInterface (caNetAddr(saddr), autoBeaconAddr, true);
|
||||
if (stat) {
|
||||
|
||||
@@ -103,7 +103,7 @@ casDGIntfIO::casDGIntfIO (caServerI &serverIn, const caNetAddr &addr,
|
||||
this->sock, &serverAddr); // match addr
|
||||
removeDuplicateAddresses ( &BCastAddrList, &tmpList, 1 );
|
||||
if (ellCount(&BCastAddrList)<1) {
|
||||
errMessage (S_cas_noInterface, "unable to continue");
|
||||
errMessage (S_cas_noInterface, "- unable to continue");
|
||||
socket_close (this->sock);
|
||||
throw S_cas_noInterface;
|
||||
}
|
||||
@@ -289,8 +289,8 @@ casDGIntfIO::osdRecv ( char * pBufIn, bufSizeT size, // X aCC 361
|
||||
}
|
||||
|
||||
addrSize = ( osiSocklen_t ) sizeof (addr);
|
||||
status = recvfrom (this->sock, pBufIn, size, 0,
|
||||
&addr, &addrSize);
|
||||
status = recvfrom ( sockThisTime, pBufIn, size, 0,
|
||||
&addr, &addrSize );
|
||||
if (status<=0) {
|
||||
if (status<0) {
|
||||
int errnoCpy = SOCKERRNO;
|
||||
@@ -368,7 +368,7 @@ bufSizeT casDGIntfIO::incomingBytesPresent () const // X aCC 361
|
||||
//
|
||||
// casDGIntfIO::sendBeaconIO()
|
||||
//
|
||||
void casDGIntfIO::sendBeaconIO ( char &msg, unsigned length,
|
||||
void casDGIntfIO::sendBeaconIO ( char & msg, unsigned length,
|
||||
aitUint16 & portField, aitUint32 & addrField )
|
||||
{
|
||||
caNetAddr addr = this->serverAddress ();
|
||||
@@ -383,7 +383,7 @@ void casDGIntfIO::sendBeaconIO ( char &msg, unsigned length,
|
||||
pAddr; pAddr = reinterpret_cast <osiSockAddrNode *> (ellNext(&pAddr->node))) {
|
||||
status = connect (this->beaconSock, &pAddr->addr.sa, sizeof(pAddr->addr.sa));
|
||||
if (status<0) {
|
||||
ipAddrToA (&pAddr->addr.ia, buf, sizeof(buf));
|
||||
ipAddrToDottedIP (&pAddr->addr.ia, buf, sizeof(buf));
|
||||
errlogPrintf ( "%s: CA beacon routing (connect to \"%s\") error was \"%s\"\n",
|
||||
__FILE__, buf, SOCKERRSTR(SOCKERRNO));
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
//
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.25 2002/07/12 21:33:37 jba
|
||||
// Updated license comments.
|
||||
//
|
||||
// Revision 1.24 2002/05/29 00:19:31 jhill
|
||||
// large array modifications
|
||||
//
|
||||
@@ -170,7 +173,7 @@ casStreamIO::casStreamIO(caServerI &cas, const ioArgsToNewStreamIO &args) :
|
||||
(char *)&i,
|
||||
sizeof(i));
|
||||
if(status < 0){
|
||||
errlogPrintf("CAS: SO_RCVBUF set failed\n");
|
||||
errlogPrintf("CAS: SO_RCVBUF set failed\n");
|
||||
throw S_cas_internal;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user