mirror of https://github.com/moparisthebest/curl
examples/asiohiper: Avoid function name collision on Windows
closesocket => close_socket Winsock already has the former. Bug: https://curl.haxx.se/mail/lib-2016-02/0016.html
This commit is contained in:
parent
6f702ebaa2
commit
c71b6a2795
|
@ -48,6 +48,7 @@
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */
|
#define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */
|
||||||
|
|
||||||
|
@ -378,9 +379,9 @@ static curl_socket_t opensocket(void *clientp, curlsocktype purpose,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CURLOPT_CLOSESOCKETFUNCTION */
|
/* CURLOPT_CLOSESOCKETFUNCTION */
|
||||||
static int closesocket(void *clientp, curl_socket_t item)
|
static int close_socket(void *clientp, curl_socket_t item)
|
||||||
{
|
{
|
||||||
fprintf(MSG_OUT, "\nclosesocket : %d", item);
|
fprintf(MSG_OUT, "\nclose_socket : %d", item);
|
||||||
|
|
||||||
std::map<curl_socket_t, boost::asio::ip::tcp::socket *>::iterator it = socket_map.find(item);
|
std::map<curl_socket_t, boost::asio::ip::tcp::socket *>::iterator it = socket_map.find(item);
|
||||||
|
|
||||||
|
@ -427,7 +428,7 @@ static void new_conn(char *url, GlobalInfo *g)
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_OPENSOCKETFUNCTION, opensocket);
|
curl_easy_setopt(conn->easy, CURLOPT_OPENSOCKETFUNCTION, opensocket);
|
||||||
|
|
||||||
/* call this function to close a socket */
|
/* call this function to close a socket */
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_CLOSESOCKETFUNCTION, closesocket);
|
curl_easy_setopt(conn->easy, CURLOPT_CLOSESOCKETFUNCTION, close_socket);
|
||||||
|
|
||||||
fprintf(MSG_OUT,
|
fprintf(MSG_OUT,
|
||||||
"\nAdding easy %p to multi %p (%s)", conn->easy, g->multi, url);
|
"\nAdding easy %p to multi %p (%s)", conn->easy, g->multi, url);
|
||||||
|
@ -441,7 +442,6 @@ static void new_conn(char *url, GlobalInfo *g)
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
GlobalInfo g;
|
GlobalInfo g;
|
||||||
CURLMcode rc;
|
|
||||||
|
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
|
|
Loading…
Reference in New Issue