sws: close sockets properly
Fix a bug where closed sockets (fd -1) were left in the all_sockets list, because of missing parens in a pointer arithmetic expression Reenable the tests that were locking up due to this bug.
This commit is contained in:
parent
0df14c8393
commit
42e4c34ff3
@ -5,6 +5,3 @@
|
|||||||
594
|
594
|
||||||
1209
|
1209
|
||||||
1211
|
1211
|
||||||
2025
|
|
||||||
2028
|
|
||||||
2031
|
|
||||||
|
@ -2065,9 +2065,9 @@ int main(int argc, char *argv[])
|
|||||||
/* Clear out closed sockets */
|
/* Clear out closed sockets */
|
||||||
for (socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) {
|
for (socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) {
|
||||||
if (CURL_SOCKET_BAD == all_sockets[socket_idx]) {
|
if (CURL_SOCKET_BAD == all_sockets[socket_idx]) {
|
||||||
char* dst = (char *) all_sockets + socket_idx;
|
char* dst = (char *) (all_sockets + socket_idx);
|
||||||
char* src = (char *) all_sockets + socket_idx + 1;
|
char* src = (char *) (all_sockets + socket_idx + 1);
|
||||||
char* end = (char *) all_sockets + num_sockets;
|
char* end = (char *) (all_sockets + num_sockets);
|
||||||
memmove(dst, src, end - src);
|
memmove(dst, src, end - src);
|
||||||
num_sockets -= 1;
|
num_sockets -= 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user