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
2705af62
Commit
2705af62
authored
13 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
sws.c: some compiler warning fixes
parent
f34ddb90
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
tests/server/sws.c
+17
-17
17 additions, 17 deletions
tests/server/sws.c
with
17 additions
and
17 deletions
tests/server/sws.c
+
17
−
17
View file @
2705af62
...
...
@@ -1227,7 +1227,6 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
memset
(
&
serveraddr
.
sa4
,
0
,
sizeof
(
serveraddr
.
sa4
));
serveraddr
.
sa4
.
sin_family
=
AF_INET
;
serveraddr
.
sa4
.
sin_port
=
htons
(
port
);
serveraddr
.
sa4
.
sin_addr
.
s_addr
=
INADDR_ANY
;
if
(
Curl_inet_pton
(
AF_INET
,
ipaddr
,
&
serveraddr
.
sa4
.
sin_addr
)
<
1
)
{
logmsg
(
"Error inet_pton failed AF_INET conversion of '%s'"
,
ipaddr
);
sclose
(
serverfd
);
...
...
@@ -1287,8 +1286,8 @@ static int http_connect(curl_socket_t infd,
curl_socket_t
serverfd
[
2
];
curl_socket_t
clientfd
[
2
];
curl_socket_t
datafd
=
CURL_SOCKET_BAD
;
in
t
toc
[
2
]
=
{
0
,
0
};
/* number of bytes to client */
in
t
tos
[
2
]
=
{
0
,
0
};
/* number of bytes to server */
ssize_
t
toc
[
2
]
=
{
0
,
0
};
/* number of bytes to client */
ssize_
t
tos
[
2
]
=
{
0
,
0
};
/* number of bytes to server */
char
readclient
[
2
][
256
];
char
readserver
[
2
][
256
];
bool
poll_client
[
2
]
=
{
TRUE
,
TRUE
};
...
...
@@ -1311,9 +1310,9 @@ static int http_connect(curl_socket_t infd,
while
(
1
)
{
fd_set
input
;
fd_set
output
;
struct
timeval
timeout
=
{
1
,
0
};
struct
timeval
timeout
=
{
1
,
0
};
ssize_t
rc
;
int
maxfd
=
0
;
curl_socket_t
maxfd
=
(
curl_socket_t
)
-
1
;
int
used
;
FD_ZERO
(
&
input
);
...
...
@@ -1321,12 +1320,13 @@ static int http_connect(curl_socket_t infd,
if
(
CURL_SOCKET_BAD
!=
rootfd
)
{
FD_SET
(
rootfd
,
&
input
);
/* monitor this for new connections */
maxfd
=
rootfd
;
maxfd
=
rootfd
;
}
/* set sockets to wait for */
for
(
i
=
0
;
i
<=
control
;
i
++
)
{
int
mostfd
=
clientfd
[
i
]
>
serverfd
[
i
]
?
clientfd
[
i
]
:
serverfd
[
i
];
curl_socket_t
mostfd
=
clientfd
[
i
]
>
serverfd
[
i
]
?
clientfd
[
i
]
:
serverfd
[
i
];
used
=
0
;
if
(
mostfd
>
maxfd
)
maxfd
=
mostfd
;
...
...
@@ -1351,7 +1351,7 @@ static int http_connect(curl_socket_t infd,
}
}
rc
=
select
(
maxfd
+
1
,
&
input
,
&
output
,
NULL
,
&
timeout
);
rc
=
select
(
(
int
)
maxfd
+
1
,
&
input
,
&
output
,
NULL
,
&
timeout
);
if
(
rc
>
0
)
{
/* socket action */
...
...
@@ -1375,7 +1375,7 @@ static int http_connect(curl_socket_t infd,
if
(
DOCNUMBER_CONNECT
!=
req2
.
testno
)
{
/* eeek, not a CONNECT */
close
(
datafd
);
s
close
(
datafd
);
break
;
}
...
...
@@ -1399,7 +1399,7 @@ static int http_connect(curl_socket_t infd,
len
=
sizeof
(
readclient
[
i
])
-
tos
[
i
];
if
(
len
&&
FD_ISSET
(
clientfd
[
i
],
&
input
))
{
/* read from client */
rc
=
re
cv
(
clientfd
[
i
],
&
readclient
[
i
][
tos
[
i
]],
len
,
0
);
rc
=
s
re
ad
(
clientfd
[
i
],
&
readclient
[
i
][
tos
[
i
]],
len
);
if
(
rc
<=
0
)
{
logmsg
(
"[%s] got %d at %s:%d, STOP READING client"
,
data_or_ctrl
(
i
),
rc
,
__FILE__
,
__LINE__
);
...
...
@@ -1416,7 +1416,7 @@ static int http_connect(curl_socket_t infd,
len
=
sizeof
(
readserver
[
i
])
-
toc
[
i
];
if
(
len
&&
FD_ISSET
(
serverfd
[
i
],
&
input
))
{
/* read from server */
rc
=
re
cv
(
serverfd
[
i
],
&
readserver
[
i
][
toc
[
i
]],
len
,
0
);
rc
=
s
re
ad
(
serverfd
[
i
],
&
readserver
[
i
][
toc
[
i
]],
len
);
if
(
rc
<=
0
)
{
logmsg
(
"[%s] got %d at %s:%d, STOP READING server"
,
data_or_ctrl
(
i
),
rc
,
__FILE__
,
__LINE__
);
...
...
@@ -1431,7 +1431,7 @@ static int http_connect(curl_socket_t infd,
}
if
(
toc
[
i
]
&&
FD_ISSET
(
clientfd
[
i
],
&
output
))
{
/* write to client */
rc
=
s
end
(
clientfd
[
i
],
readserver
[
i
],
toc
[
i
]
,
0
);
rc
=
s
write
(
clientfd
[
i
],
readserver
[
i
],
toc
[
i
]);
if
(
rc
<=
0
)
{
logmsg
(
"[%s] got %d at %s:%d"
,
data_or_ctrl
(
i
),
rc
,
__FILE__
,
__LINE__
);
...
...
@@ -1447,7 +1447,7 @@ static int http_connect(curl_socket_t infd,
}
if
(
tos
[
i
]
&&
FD_ISSET
(
serverfd
[
i
],
&
output
))
{
/* write to server */
rc
=
s
end
(
serverfd
[
i
],
readclient
[
i
],
tos
[
i
]
,
0
);
rc
=
s
write
(
serverfd
[
i
],
readclient
[
i
],
tos
[
i
]);
if
(
rc
<=
0
)
{
logmsg
(
"[%s] got %d at %s:%d"
,
data_or_ctrl
(
i
),
rc
,
__FILE__
,
__LINE__
);
...
...
@@ -1485,9 +1485,9 @@ static int http_connect(curl_socket_t infd,
sleep
(
1
);
if
(
serverfd
[
precontrol
]
!=
CURL_SOCKET_BAD
)
close
(
serverfd
[
precontrol
]);
s
close
(
serverfd
[
precontrol
]);
if
(
clientfd
[
precontrol
]
!=
CURL_SOCKET_BAD
)
close
(
clientfd
[
precontrol
]);
s
close
(
clientfd
[
precontrol
]);
}
...
...
@@ -1499,9 +1499,9 @@ static int http_connect(curl_socket_t infd,
/* close all sockets we created */
for(i=0; i<2; i++) {
if(serverfd[i] != CURL_SOCKET_BAD)
close(serverfd[i]);
s
close(serverfd[i]);
if(clientfd[i] != CURL_SOCKET_BAD)
close(clientfd[i]);
s
close(clientfd[i]);
}
#endif
return
0
;
...
...
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