diff options
Diffstat (limited to 'lib/memdebug.c')
-rw-r--r-- | lib/memdebug.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/memdebug.c b/lib/memdebug.c index 0eb249ce9..8e61aba71 100644 --- a/lib/memdebug.c +++ b/lib/memdebug.c @@ -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], |