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
2694b970
Commit
2694b970
authored
17 years ago
by
Steinar H. Gunderson
Browse files
Options
Downloads
Patches
Plain Diff
Port the TCP socket fix made in ares_fds() to ares_getsock() as well.
parent
23f5d145
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ares/ares_getsock.c
+11
-5
11 additions, 5 deletions
ares/ares_getsock.c
with
11 additions
and
5 deletions
ares/ares_getsock.c
+
11
−
5
View file @
2694b970
...
...
@@ -34,16 +34,18 @@ int ares_getsock(ares_channel channel,
ares_socket_t
*
socks
=
(
ares_socket_t
*
)
s
;
/* No queries, no file descriptors. */
if
(
ares__is_list_empty
(
&
(
channel
->
all_queries
)))
return
0
;
/* Are there any active queries? */
int
active_queries
=
!
ares__is_list_empty
(
&
(
channel
->
all_queries
));
for
(
i
=
0
;
(
i
<
channel
->
nservers
)
&&
(
sockindex
<
ARES_GETSOCK_MAXNUM
);
i
++
)
{
server
=
&
channel
->
servers
[
i
];
if
(
server
->
udp_socket
!=
ARES_SOCKET_BAD
)
/* We only need to register interest in UDP sockets if we have
* outstanding queries.
*/
if
(
active_queries
&&
server
->
udp_socket
!=
ARES_SOCKET_BAD
)
{
if
(
sockindex
>=
numsocks
)
break
;
...
...
@@ -51,6 +53,10 @@ int ares_getsock(ares_channel channel,
bitmap
|=
ARES_GETSOCK_READABLE
(
setbits
,
sockindex
);
sockindex
++
;
}
/* We always register for TCP events, because we want to know
* when the other side closes the connection, so we don't waste
* time trying to use a broken connection.
*/
if
(
server
->
tcp_socket
!=
ARES_SOCKET_BAD
)
{
if
(
sockindex
>=
numsocks
)
...
...
@@ -58,7 +64,7 @@ int ares_getsock(ares_channel channel,
socks
[
sockindex
]
=
server
->
tcp_socket
;
bitmap
|=
ARES_GETSOCK_READABLE
(
setbits
,
sockindex
);
if
(
server
->
qhead
)
if
(
server
->
qhead
&&
active_queries
)
/* then the tcp socket is also writable! */
bitmap
|=
ARES_GETSOCK_WRITABLE
(
setbits
,
sockindex
);
...
...
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