Commit d315911c authored by Oleksandr Dmytrenko's avatar Oleksandr Dmytrenko

recursion in ip server(windows) fix

1)cause recursion fix:
        ERROR: OIC_CA_IP_SERVER: secure unicast ipv6 sendTo failed: 10014
        DEBUG: OIC_CA_INF_CTR: received error from adapter in interfacecontroller
2)time in cases WSAENOBUFS and WSAEWOULDBLOCK
3)logging fix

Change-Id: I9e680a0bb43a327a77ce4dca7264cad5aaeb8615
Signed-off-by: default avatarOleksandr Dmytrenko <o.dmytrenko@samsung.com>
parent 7f5fe36c
......@@ -1436,10 +1436,12 @@ static void sendData(CASocketFd_t fd, const CAEndpoint_t *endpoint,
len, true, NULL);
}
#else
int err = 0;
#define SOCKET_ERROR_WAIT 300
int len = 0;
size_t sent = 0;
int err;
do {
err = 0;
int dataToSend = ((dlen - sent) > INT_MAX) ? INT_MAX : (int)(dlen - sent);
len = sendto(fd, ((char*)data) + sent, dataToSend, 0, (struct sockaddr *)&sock, socklen);
if (OC_SOCKET_ERROR == len)
......@@ -1447,14 +1449,17 @@ static void sendData(CASocketFd_t fd, const CAEndpoint_t *endpoint,
err = WSAGetLastError();
if ((WSAEWOULDBLOCK != err) && (WSAENOBUFS != err))
{
OIC_LOG_V(ERROR, TAG, "%s%s %s sendTo failed: %i", secure, cast, fam, err);
// If logging is not defined/enabled.
if (g_ipErrorHandler)
{
g_ipErrorHandler(endpoint, data, dlen, CA_SEND_FAILED);
}
OIC_LOG_V(ERROR, TAG, "%s%s %s sendTo failed: %i", secure, cast, fam, err);
break;
}
OIC_LOG_V(WARNING, TAG, "%s%s %s sendTo failed: %s", secure, cast, fam,
err == WSAEWOULDBLOCK ? "Resource temporarily unavailable." : "No buffer space available." );
Sleep(SOCKET_ERROR_WAIT);
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment