|
@@ -81,47 +81,47 @@ uint8_t UDS_ReceiveData( UDS_CHANNEL_T *UDSInfo, char *szBuffer, uint32_t* pdwSi
|
|
|
IPMIUDSMsg_T *pData = (IPMIUDSMsg_T *)szBuffer;
|
|
|
uint32_t nBytesRecvd = 0;
|
|
|
|
|
|
- /* Wait for the socket to get ready */
|
|
|
- if(timeout >= 0)
|
|
|
- {
|
|
|
- wait_time.tv_sec = timeout;
|
|
|
- wait_time.tv_usec = 0;
|
|
|
- pwait_time = &wait_time;
|
|
|
- }
|
|
|
- else
|
|
|
- pwait_time = NULL;
|
|
|
-
|
|
|
- FD_ZERO(&rdfs);
|
|
|
- FD_SET(UDSInfo->hSocket, &rdfs);
|
|
|
- nDes = UDSInfo->hSocket + 1;
|
|
|
+ // /* Wait for the socket to get ready */
|
|
|
+ // if(timeout >= 0)
|
|
|
+ // {
|
|
|
+ // wait_time.tv_sec = timeout;
|
|
|
+ // wait_time.tv_usec = 0;
|
|
|
+ // pwait_time = &wait_time;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // pwait_time = NULL;
|
|
|
+
|
|
|
+ // FD_ZERO(&rdfs);
|
|
|
+ // FD_SET(UDSInfo->hSocket, &rdfs);
|
|
|
+ // nDes = UDSInfo->hSocket + 1;
|
|
|
|
|
|
while(1)
|
|
|
{
|
|
|
/* wait for specified amount of time */
|
|
|
- ret = select (nDes, &rdfs, NULL, NULL, pwait_time);
|
|
|
- /* socket error */
|
|
|
- if(ret == -1)
|
|
|
- {
|
|
|
- if(errno == EINTR)
|
|
|
- {
|
|
|
- printf("select: %s. Continue...\n",strerror(errno));
|
|
|
- continue;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- printf("select failed while waiting for read pipe \n");
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- else if(ret == 0)
|
|
|
- {
|
|
|
- printf("Connection timed out\n");
|
|
|
- return LIBIPMI_MEDIUM_E_TIMED_OUT;
|
|
|
- }
|
|
|
-
|
|
|
- /* socket is ready to receive data */
|
|
|
- if(FD_ISSET(UDSInfo->hSocket,&rdfs))
|
|
|
- {
|
|
|
+ // ret = select (nDes, &rdfs, NULL, NULL, pwait_time);
|
|
|
+ // /* socket error */
|
|
|
+ // if(ret == -1)
|
|
|
+ // {
|
|
|
+ // if(errno == EINTR)
|
|
|
+ // {
|
|
|
+ // printf("select: %s. Continue...\n",strerror(errno));
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // printf("select failed while waiting for read pipe \n");
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else if(ret == 0)
|
|
|
+ // {
|
|
|
+ // printf("Connection timed out\n");
|
|
|
+ // return LIBIPMI_MEDIUM_E_TIMED_OUT;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // /* socket is ready to receive data */
|
|
|
+ // if(FD_ISSET(UDSInfo->hSocket,&rdfs))
|
|
|
+ {
|
|
|
nBytesRecvd = recv(UDSInfo->hSocket,szBuffer+totalrecvd,MAX_RESPONSE_SIZE,0);
|
|
|
if(nBytesRecvd == 0)
|
|
|
{
|
|
@@ -156,7 +156,7 @@ uint8_t UDS_ReceiveData( UDS_CHANNEL_T *UDSInfo, char *szBuffer, uint32_t* pdwSi
|
|
|
return LIBIPMI_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
|
- return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
|
|
|
+ //return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -169,49 +169,49 @@ int UDS_SendData(UDS_CHANNEL_T *UDSInfo,char *szBuffer,uint32_t dwsize,int timeo
|
|
|
struct timeval wait_time, *pwait_time;
|
|
|
fd_set wdfs;
|
|
|
int ret;
|
|
|
- int nDes;
|
|
|
-
|
|
|
- /* Wait for the socket to get ready */
|
|
|
- if(timeout >= 0)
|
|
|
- {
|
|
|
- wait_time.tv_sec = timeout;
|
|
|
- wait_time.tv_usec = 0;
|
|
|
- pwait_time = &wait_time;
|
|
|
- }
|
|
|
- else
|
|
|
- pwait_time = NULL;
|
|
|
-
|
|
|
- FD_ZERO(&wdfs);
|
|
|
- FD_SET(UDSInfo->hSocket, &wdfs);
|
|
|
- nDes = UDSInfo->hSocket + 1;
|
|
|
-
|
|
|
-TCPSendUDSDataSelect:
|
|
|
- /* wait for specified amount of time */
|
|
|
- ret = select (nDes, NULL, &wdfs, NULL, pwait_time);
|
|
|
- /* socket error */
|
|
|
- if(ret == -1)
|
|
|
- {
|
|
|
- if(errno == EINTR)
|
|
|
- {
|
|
|
- printf("select: %s. Continue...\n",strerror(errno));
|
|
|
- goto TCPSendUDSDataSelect;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- printf("Select failed while waiting for write pipe \n");
|
|
|
- close(UDSInfo->hSocket);
|
|
|
- return LIBIPMI_MEDIUM_E_INVALID_SOCKET;
|
|
|
- }
|
|
|
- }
|
|
|
- /* timed out */
|
|
|
- else if(ret == 0)
|
|
|
- {
|
|
|
- printf("Connection timedout: Write Pipe is full \n");
|
|
|
- close(UDSInfo->hSocket);
|
|
|
- return LIBIPMI_MEDIUM_E_TIMED_OUT_ON_SEND;
|
|
|
- }
|
|
|
-
|
|
|
- if(FD_ISSET(UDSInfo->hSocket,&wdfs))
|
|
|
+ // int nDes;
|
|
|
+
|
|
|
+ // /* Wait for the socket to get ready */
|
|
|
+ // if(timeout >= 0)
|
|
|
+ // {
|
|
|
+ // wait_time.tv_sec = timeout;
|
|
|
+ // wait_time.tv_usec = 0;
|
|
|
+ // pwait_time = &wait_time;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // pwait_time = NULL;
|
|
|
+
|
|
|
+ // FD_ZERO(&wdfs);
|
|
|
+ // FD_SET(UDSInfo->hSocket, &wdfs);
|
|
|
+ // nDes = UDSInfo->hSocket + 1;
|
|
|
+
|
|
|
+// TCPSendUDSDataSelect:
|
|
|
+// /* wait for specified amount of time */
|
|
|
+// ret = select (nDes, NULL, &wdfs, NULL, pwait_time);
|
|
|
+// /* socket error */
|
|
|
+// if(ret == -1)
|
|
|
+// {
|
|
|
+// if(errno == EINTR)
|
|
|
+// {
|
|
|
+// printf("select: %s. Continue...\n",strerror(errno));
|
|
|
+// goto TCPSendUDSDataSelect;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// printf("Select failed while waiting for write pipe \n");
|
|
|
+// close(UDSInfo->hSocket);
|
|
|
+// return LIBIPMI_MEDIUM_E_INVALID_SOCKET;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// /* timed out */
|
|
|
+// else if(ret == 0)
|
|
|
+// {
|
|
|
+// printf("Connection timedout: Write Pipe is full \n");
|
|
|
+// close(UDSInfo->hSocket);
|
|
|
+// return LIBIPMI_MEDIUM_E_TIMED_OUT_ON_SEND;
|
|
|
+// }
|
|
|
+
|
|
|
+ // if(FD_ISSET(UDSInfo->hSocket,&wdfs))
|
|
|
{
|
|
|
/* socket is ready to send data */
|
|
|
nTotalBytesSent = 0;
|
|
@@ -247,6 +247,6 @@ TCPSendUDSDataSelect:
|
|
|
return LIBIPMI_STATUS_SUCCESS;
|
|
|
|
|
|
}
|
|
|
- return LIBIPMI_MEDIUM_E_SEND_DATA_FAILURE;
|
|
|
+ //return LIBIPMI_MEDIUM_E_SEND_DATA_FAILURE;
|
|
|
}
|
|
|
|