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
532bca41
Commit
532bca41
authored
23 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Curl_tvdiff() now returns a millisecond diff, no double like before
parent
b438c467
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
lib/connect.c
+4
-4
4 additions, 4 deletions
lib/connect.c
lib/speedcheck.c
+2
-1
2 additions, 1 deletion
lib/speedcheck.c
lib/timeval.c
+3
-2
3 additions, 2 deletions
lib/timeval.c
lib/timeval.h
+4
-1
4 additions, 1 deletion
lib/timeval.h
lib/url.c
+2
-2
2 additions, 2 deletions
lib/url.c
with
15 additions
and
10 deletions
lib/connect.c
+
4
−
4
View file @
532bca41
...
...
@@ -353,7 +353,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
if
(
data
->
set
.
timeout
||
data
->
set
.
connecttimeout
)
{
double
has_passed
;
/* Evaluate how much t
hat
that has passed */
/* Evaluate
in milliseconds
how much t
ime
that has passed */
has_passed
=
Curl_tvdiff
(
Curl_tvnow
(),
data
->
progress
.
start
);
#ifndef min
...
...
@@ -368,7 +368,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
timeout_ms
=
data
->
set
.
connecttimeout
*
1000
;
/* subtract the passed time */
timeout_ms
-=
(
long
)
(
has_passed
*
1000
)
;
timeout_ms
-=
(
long
)
has_passed
;
if
(
timeout_ms
<
0
)
/* a precaution, no need to continue if time already is up */
...
...
@@ -436,7 +436,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
/* get a new timeout for next attempt */
after
=
Curl_tvnow
();
timeout_ms
-=
(
long
)(
Curl_tvdiff
(
after
,
before
)
*
1000
)
;
timeout_ms
-=
Curl_tvdiff
(
after
,
before
);
if
(
timeout_ms
<
0
)
{
failf
(
data
,
"connect() timed out!"
);
return
CURLE_OPERATION_TIMEOUTED
;
...
...
@@ -521,7 +521,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
if
(
0
!=
rc
)
{
/* get a new timeout for next attempt */
after
=
Curl_tvnow
();
timeout_ms
-=
(
long
)(
Curl_tvdiff
(
after
,
before
)
*
1000
)
;
timeout_ms
-=
Curl_tvdiff
(
after
,
before
);
if
(
timeout_ms
<
0
)
{
failf
(
data
,
"Connect timeout on IP number %d"
,
aliasindex
+
1
);
break
;
...
...
This diff is collapsed.
Click to expand it.
lib/speedcheck.c
+
2
−
1
View file @
532bca41
...
...
@@ -51,7 +51,8 @@ CURLcode Curl_speedcheck(struct SessionHandle *data,
for "low speed time" seconds we consider that enough reason
to abort the download. */
if
(
Curl_tvdiff
(
now
,
data
->
state
.
keeps_speed
)
>
data
->
set
.
low_speed_time
)
{
if
(
(
Curl_tvdiff
(
now
,
data
->
state
.
keeps_speed
)
/
1000
)
>
data
->
set
.
low_speed_time
)
{
/* we have been this slow for long enough, now die */
failf
(
data
,
"Operation too slow. "
...
...
This diff is collapsed.
Click to expand it.
lib/timeval.c
+
3
−
2
View file @
532bca41
...
...
@@ -69,9 +69,10 @@ struct timeval Curl_tvnow (void)
* Make sure that the first argument is the more recent time, as otherwise
* we'll get a weird negative time-diff back...
*/
double
Curl_tvdiff
(
struct
timeval
t1
,
struct
timeval
t2
)
long
Curl_tvdiff
(
struct
timeval
t1
,
struct
timeval
t2
)
{
return
(
double
)(
t1
.
tv_sec
-
t2
.
tv_sec
)
+
((
t1
.
tv_usec
-
t2
.
tv_usec
)
/
1000000
.
0
);
return
(
t1
.
tv_sec
*
1000
+
t1
.
tv_usec
/
1000
)
-
(
t2
.
tv_sec
*
1000
+
t2
.
tv_usec
/
1000
);
}
long
Curl_tvlong
(
struct
timeval
t1
)
...
...
This diff is collapsed.
Click to expand it.
lib/timeval.h
+
4
−
1
View file @
532bca41
...
...
@@ -43,7 +43,10 @@ struct timeval {
#endif
struct
timeval
Curl_tvnow
();
double
Curl_tvdiff
(
struct
timeval
t1
,
struct
timeval
t2
);
/* the diff is from now on returned in number of milliseconds! */
long
Curl_tvdiff
(
struct
timeval
t1
,
struct
timeval
t2
);
long
Curl_tvlong
(
struct
timeval
t1
);
#endif
This diff is collapsed.
Click to expand it.
lib/url.c
+
2
−
2
View file @
532bca41
...
...
@@ -1055,14 +1055,14 @@ ConnectionKillOne(struct SessionHandle *data)
* Set higher score for the age passed since the connection
* was used.
*/
score
=
Curl_tv
long
(
now
)
-
Curl_tvlong
(
conn
->
now
);
score
=
Curl_tv
diff
(
now
,
conn
->
now
);
break
;
case
CURLCLOSEPOLICY_OLDEST
:
/*
* Set higher score for the age passed since the connection
* was created.
*/
score
=
Curl_tv
long
(
now
)
-
Curl_tvlong
(
conn
->
created
);
score
=
Curl_tv
diff
(
now
,
conn
->
created
);
break
;
}
...
...
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