Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
69c2084a
Commit
69c2084a
authored
19 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
updated test programs to use the API as it currently works
parent
99c0a1a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hiper/hiper.c
+7
-4
7 additions, 4 deletions
hiper/hiper.c
hiper/shiper.c
+18
-27
18 additions, 27 deletions
hiper/shiper.c
with
25 additions
and
31 deletions
hiper/hiper.c
+
7
−
4
View file @
69c2084a
...
...
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
curl_easy_setopt
(
e
,
CURLOPT_URL
,
conns
[
i
].
url
);
curl_easy_setopt
(
e
,
CURLOPT_WRITEFUNCTION
,
writecallback
);
curl_easy_setopt
(
e
,
CURLOPT_WRITEDATA
,
&
conns
[
i
]);
#if
0
#if
1
curl_easy_setopt
(
e
,
CURLOPT_VERBOSE
,
1
);
#endif
curl_easy_setopt
(
e
,
CURLOPT_ERRORBUFFER
,
conns
[
i
].
error
);
...
...
@@ -319,6 +319,7 @@ int main(int argc, char **argv)
while
(
still_running
==
num_total
)
{
struct
timeval
timeout
;
int
rc
;
/* select() return code */
long
timeout_ms
;
fd2_set
fdread
;
fd2_set
fdwrite
;
...
...
@@ -329,9 +330,11 @@ int main(int argc, char **argv)
FD2_ZERO
(
&
fdwrite
);
FD2_ZERO
(
&
fdexcep
);
/* set a suitable timeout to play around with */
timeout
.
tv_sec
=
0
;
timeout
.
tv_usec
=
50000
;
curl_multi_timeout
(
multi_handle
,
&
timeout_ms
);
/* set timeout to wait */
timeout
.
tv_sec
=
timeout_ms
/
1000
;
timeout
.
tv_usec
=
(
timeout_ms
%
1000
)
*
1000
;
/* get file descriptors from the transfers */
curl_multi_fdset
(
multi_handle
,
...
...
This diff is collapsed.
Click to expand it.
hiper/shiper.c
+
18
−
27
View file @
69c2084a
...
...
@@ -124,19 +124,18 @@ static void remsock(curl_socket_t s)
}
static
void
setsock
(
struct
fdinfo
*
fdp
,
curl_socket_t
s
,
CURL
*
easy
,
int
action
,
long
timeout
)
int
action
)
{
fdp
->
sockfd
=
s
;
fdp
->
action
=
action
;
fdp
->
timeout
=
timeout
;
fdp
->
easy
=
easy
;
}
static
void
addsock
(
curl_socket_t
s
,
CURL
*
easy
,
int
action
,
long
timeout
)
static
void
addsock
(
curl_socket_t
s
,
CURL
*
easy
,
int
action
)
{
struct
fdinfo
*
fdp
=
calloc
(
sizeof
(
struct
fdinfo
),
1
);
setsock
(
fdp
,
s
,
easy
,
action
,
timeout
);
setsock
(
fdp
,
s
,
easy
,
action
);
if
(
allsocks
)
{
fdp
->
next
=
allsocks
;
...
...
@@ -190,8 +189,7 @@ static void fdinfo2fdset(fd2_set *fdread, fd2_set *fdwrite, int *maxfd)
#endif
}
/* on port 8999 we run a modified (fork-) sws that supports pure idle and full
stream mode */
/* on port 8999 we run a fork enabled sws that supports 'idle' and 'stream' */
#define PORT "8999"
#define HOST "192.168.1.13"
...
...
@@ -203,11 +201,10 @@ static void fdinfo2fdset(fd2_set *fdread, fd2_set *fdwrite, int *maxfd)
static
int
socket_callback
(
CURL
*
easy
,
/* easy handle */
curl_socket_t
s
,
/* socket */
int
what
,
/* see above */
long
ms
,
/* timeout for wait */
void
*
userp
)
/* "private" pointer */
{
struct
fdinfo
*
fdp
;
printf
(
"socket %d easy %p what %d
timeout %ld
\n
"
,
s
,
easy
,
what
,
ms
);
printf
(
"socket %d easy %p what %d
\n
"
,
s
,
easy
,
what
);
if
(
what
==
CURL_POLL_REMOVE
)
remsock
(
s
);
...
...
@@ -215,13 +212,13 @@ static int socket_callback(CURL *easy, /* easy handle */
fdp
=
findsock
(
s
);
if
(
!
fdp
)
{
addsock
(
s
,
easy
,
what
,
ms
);
addsock
(
s
,
easy
,
what
);
}
else
{
/* we already know about it, just change action/timeout */
printf
(
"Changing info for socket %d from %d to %d
\n
"
,
s
,
fdp
->
action
,
what
);
setsock
(
fdp
,
s
,
easy
,
what
,
ms
);
setsock
(
fdp
,
s
,
easy
,
what
);
}
}
return
0
;
/* return code meaning? */
...
...
@@ -440,9 +437,7 @@ int main(int argc, char **argv)
curl_easy_setopt
(
e
,
CURLOPT_URL
,
conns
[
i
].
url
);
curl_easy_setopt
(
e
,
CURLOPT_WRITEFUNCTION
,
writecallback
);
curl_easy_setopt
(
e
,
CURLOPT_WRITEDATA
,
&
conns
[
i
]);
#if 0
curl_easy_setopt
(
e
,
CURLOPT_VERBOSE
,
1
);
#endif
curl_easy_setopt
(
e
,
CURLOPT_ERRORBUFFER
,
conns
[
i
].
error
);
curl_easy_setopt
(
e
,
CURLOPT_PRIVATE
,
&
conns
[
i
]);
...
...
@@ -464,14 +459,17 @@ int main(int argc, char **argv)
while
(
1
)
{
struct
timeval
timeout
;
int
rc
;
/* select() return code */
long
timeout_ms
;
fd2_set
fdread
;
fd2_set
fdwrite
;
int
maxfd
;
/* set a suitable timeout to play around with */
timeout
.
tv_sec
=
1
;
timeout
.
tv_usec
=
0
;
curl_multi_timeout
(
multi_handle
,
&
timeout_ms
);
/* set timeout to wait */
timeout
.
tv_sec
=
timeout_ms
/
1000
;
timeout
.
tv_usec
=
(
timeout_ms
%
1000
)
*
1000
;
/* convert file descriptors from the transfers to fd_sets */
fdinfo2fdset
(
&
fdread
,
&
fdwrite
,
&
maxfd
);
...
...
@@ -487,6 +485,10 @@ int main(int argc, char **argv)
break
;
case
0
:
timeouts
++
;
curl_multi_socket
(
multi_handle
,
CURL_SOCKET_TIMEOUT
,
socket_callback
,
NULL
);
break
;
default:
/* timeout or readable/writable sockets */
...
...
@@ -505,25 +507,14 @@ int main(int argc, char **argv)
if
(
act
)
{
multi_socket
++
;
#if 0
printf("multi_socket for %p socket %d (%d)\n",
fdp, fdp->sockfd, act);
#endif
timer_continue
();
if
(
act
&
CURL_POLL_OUT
)
act
--
;
curl_multi_socket
(
multi_handle
,
CURL_SOCKET_BAD
,
fdp
->
easy
,
socket_callback
,
NULL
);
curl_multi_socket
(
multi_handle
,
fdp
->
sockfd
,
socket_callback
,
NULL
);
timer_pause
();
}
}
#if 0
curl_multi_socket_all(multi_handle, socket_callback, NULL);
#endif
performselect
+=
rc
;
if
(
rc
>
topselect
)
topselect
=
rc
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment