summaryrefslogtreecommitdiff
path: root/tests/libtest/lib582.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-03-12 23:01:16 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-03-12 23:01:16 +0100
commit7612ca2a7e9f0230ab4166e8b0a5abb2557d242c (patch)
treecac4549fedd1b9e9a24341a1a47ca1f0e8ba9d83 /tests/libtest/lib582.c
parent029136da6054a3b2d6cb36b3b4f2ed34f83e010a (diff)
downloadcurl-7612ca2a7e9f0230ab4166e8b0a5abb2557d242c.tar.gz
test582: improved info messages
Diffstat (limited to 'tests/libtest/lib582.c')
-rw-r--r--tests/libtest/lib582.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c
index fe777aced..7f87f1d15 100644
--- a/tests/libtest/lib582.c
+++ b/tests/libtest/lib582.c
@@ -28,7 +28,7 @@
#include "testutil.h"
#include "memdebug.h"
-#define MAIN_LOOP_HANG_TIMEOUT 10 * 1000
+#define MAIN_LOOP_HANG_TIMEOUT 4 * 1000
struct Sockets
{
@@ -44,11 +44,12 @@ struct ReadWriteSockets
/**
* Remove a file descriptor from a sockets array.
*/
-static void removeFd(struct Sockets* sockets, curl_socket_t fd)
+static void removeFd(struct Sockets* sockets, curl_socket_t fd, int mention)
{
int i;
- fprintf(stderr, "Remove socket fd %d\n", (int) fd);
+ if(mention)
+ fprintf(stderr, "Remove socket fd %d\n", (int) fd);
for (i = 0; i < sockets->count; ++i) {
if (sockets->sockets[i] == fd) {
@@ -62,14 +63,14 @@ static void removeFd(struct Sockets* sockets, curl_socket_t fd)
/**
* Add a file descriptor to a sockets array.
*/
-static void addFd(struct Sockets* sockets, curl_socket_t fd)
+static void addFd(struct Sockets* sockets, curl_socket_t fd, const char *what)
{
/**
* To ensure we only have each file descriptor once, we remove it then add
* it again.
*/
- fprintf(stderr, "Add socket fd %d\n", (int) fd);
- removeFd(sockets, fd);
+ fprintf(stderr, "Add socket fd %d for %s\n", (int) fd, what);
+ removeFd(sockets, fd, 0);
sockets->sockets = realloc(sockets->sockets,
sizeof(curl_socket_t) * (sockets->count + 1));
sockets->sockets[sockets->count] = fd;
@@ -88,14 +89,15 @@ static int curlSocketCallback(CURL *easy, curl_socket_t s, int action,
(void)socketp; /* unused */
if (action == CURL_POLL_IN || action == CURL_POLL_INOUT)
- addFd(&sockets->read, s);
- else
- removeFd(&sockets->read, s);
+ addFd(&sockets->read, s, "read");
if (action == CURL_POLL_OUT || action == CURL_POLL_INOUT)
- addFd(&sockets->write, s);
- else
- removeFd(&sockets->write, s);
+ addFd(&sockets->write, s, "write");
+
+ if(action == CURL_POLL_REMOVE) {
+ removeFd(&sockets->read, s, 1);
+ removeFd(&sockets->write, s, 0);
+ }
return 0;
}
@@ -241,6 +243,7 @@ int test(char *URL)
fclose(hd_src);
return -1;
}
+ fprintf(stderr, "Set to upload %d bytes\n", (int)file_info.st_size);
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
@@ -358,8 +361,10 @@ test_cleanup:
if(m)
curl_multi_remove_handle(m, curl);
curl_easy_cleanup(curl);
- if(m)
+ if(m) {
+ fprintf(stderr, "Now multi-cleanup!\n");
curl_multi_cleanup(m);
+ }
fclose(hd_src); /* close the local file */
if (sockets.read.sockets != 0)