mirror of
https://github.com/curl/curl.git
synced 2026-07-26 08:57:16 +03:00
memdebug: trace send, recv and socket
... to allow them to be included in torture tests too. closes #1980
This commit is contained in:
parent
4af3c777a9
commit
ad164eceb3
5 changed files with 73 additions and 18 deletions
|
|
@ -343,7 +343,12 @@ curl_socket_t curl_socket(int domain, int type, int protocol,
|
|||
"FD %s:%d socket() = %ld\n" :
|
||||
"FD %s:%d socket() = %zd\n";
|
||||
|
||||
curl_socket_t sockfd = socket(domain, type, protocol);
|
||||
curl_socket_t sockfd;
|
||||
|
||||
if(countcheck("socket", line, source))
|
||||
return CURL_SOCKET_BAD;
|
||||
|
||||
sockfd = socket(domain, type, protocol);
|
||||
|
||||
if(source && (sockfd != CURL_SOCKET_BAD))
|
||||
curl_memlog(fmt, source, line, sockfd);
|
||||
|
|
@ -351,6 +356,32 @@ curl_socket_t curl_socket(int domain, int type, int protocol,
|
|||
return sockfd;
|
||||
}
|
||||
|
||||
ssize_t curl_dosend(int sockfd, const void *buf, size_t len, int flags,
|
||||
int line, const char *source)
|
||||
{
|
||||
ssize_t rc;
|
||||
if(countcheck("send", line, source))
|
||||
return -1;
|
||||
rc = send(sockfd, buf, len, flags);
|
||||
if(source)
|
||||
curl_memlog("SEND %s:%d send(%zu) = %zd\n",
|
||||
source, line, len, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
ssize_t curl_dorecv(int sockfd, void *buf, size_t len, int flags,
|
||||
int line, const char *source)
|
||||
{
|
||||
ssize_t rc;
|
||||
if(countcheck("recv", line, source))
|
||||
return -1;
|
||||
rc = recv(sockfd, buf, len, flags);
|
||||
if(source)
|
||||
curl_memlog("RECV %s:%d recv(%zu) = %zd\n",
|
||||
source, line, len, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
int curl_socketpair(int domain, int type, int protocol,
|
||||
curl_socket_t socket_vector[2],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue