|
@@ -716,21 +716,12 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
|
|
|
uint8_t PBTbl;
|
|
|
|
|
|
pthread_mutex_lock(&api_bridge_mutex);
|
|
|
- //create BRIDGE_QUEUE
|
|
|
- if(-1 != access(BRIDGE_QUEUE, F_OK))
|
|
|
- {
|
|
|
- remove(BRIDGE_QUEUE);
|
|
|
- }
|
|
|
- if(0 != mkfifo (BRIDGE_QUEUE, 0777))
|
|
|
- {
|
|
|
- printf("%s: Create %s fifo failed! \n", __FUNCTION__, BRIDGE_QUEUE);
|
|
|
- pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
- return -1;
|
|
|
- }
|
|
|
+
|
|
|
fd_BridgeQue = open (BRIDGE_QUEUE, O_RDWR);
|
|
|
if(-1 == fd_BridgeQue)
|
|
|
{
|
|
|
printf("%s: Open %s fifo failed! \n", __FUNCTION__, BRIDGE_QUEUE);
|
|
|
+ close(fd_BridgeQue);
|
|
|
pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
return -1;
|
|
|
}
|
|
@@ -744,7 +735,7 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
|
|
|
else
|
|
|
{
|
|
|
printf("Warning: Message Packet to be bridged is NULL\r\n");
|
|
|
- remove(BRIDGE_QUEUE);
|
|
|
+ close(fd_BridgeQue);
|
|
|
pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
return -1;
|
|
|
}
|
|
@@ -755,7 +746,7 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
|
|
|
else
|
|
|
{
|
|
|
printf("Warning: Message Packet to be bridged is NULL\r\n");
|
|
|
- remove(BRIDGE_QUEUE);
|
|
|
+ close(fd_BridgeQue);
|
|
|
pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
return -1;
|
|
|
}
|
|
@@ -775,8 +766,8 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
|
|
|
else
|
|
|
{
|
|
|
printf ("Warning: Invalid IPMB Channel: %d\r\n", Channel);
|
|
|
- remove(BRIDGE_QUEUE);
|
|
|
pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
+ close(fd_BridgeQue);
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -826,7 +817,7 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
|
|
|
if(SeqNum == g_BMCInfo.SendMsgSeqNum)
|
|
|
{
|
|
|
printf ("Warning: Pending Bridge Response Table is full \n");
|
|
|
- remove(BRIDGE_QUEUE);
|
|
|
+ close(fd_BridgeQue);
|
|
|
pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
return -1;
|
|
|
}
|
|
@@ -852,7 +843,7 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
|
|
|
else
|
|
|
{
|
|
|
printf("Warning: Invalid Channel %d\n", Channel);
|
|
|
- remove(BRIDGE_QUEUE);
|
|
|
+ close(fd_BridgeQue);
|
|
|
pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
return -1;
|
|
|
}
|
|
@@ -861,14 +852,14 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
|
|
|
if(0 != PostMsg(pReqPkt->SrcQ, pReqPkt) )
|
|
|
{
|
|
|
printf ("Warning: oemApi.c : Error posting message to Queue %p \n", pReqPkt->SrcQ);
|
|
|
- remove(BRIDGE_QUEUE);
|
|
|
+ close(fd_BridgeQue);
|
|
|
pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
m_PendingBridgedResTbl[PBTbl][SeqNum].ResDataOk = 1;
|
|
|
|
|
|
- RetVal = GetMsg (fd_BridgeQue, pResPkt, 5000); //3s
|
|
|
+ RetVal = GetMsg (fd_BridgeQue, pResPkt, 3); //3s
|
|
|
|
|
|
// int i;
|
|
|
// printf("Bridge recv: ");
|
|
@@ -878,7 +869,8 @@ int API_BridgeInternal(MsgPkt_T* pReqPkt, MsgPkt_T* pResPkt, uint8_t DestAddr, i
|
|
|
// }
|
|
|
// printf("\n");
|
|
|
|
|
|
- remove(BRIDGE_QUEUE);
|
|
|
+ //remove(BRIDGE_QUEUE);
|
|
|
+ close(fd_BridgeQue);
|
|
|
pthread_mutex_unlock(&api_bridge_mutex);
|
|
|
if(RetVal != 0)
|
|
|
{
|