| 1 | --- axel-2.16.1/src/axel.c 2017-12-05 10:46:05.000000000 +0530 |
| 2 | +++ axel.c 2018-03-14 19:29:42.000000000 +0530 |
| 3 | @@ -617,7 +617,7 @@ |
| 4 | } else { |
| 5 | if (gettime() > (axel->conn[i].last_transfer + |
| 6 | axel->conf->reconnect_delay)) { |
| 7 | - pthread_cancel(*axel->conn[i].setup_thread); |
| 8 | + pthread_kill(*axel->conn[i].setup_thread, 0); |
| 9 | axel->conn[i].state = false; |
| 10 | pthread_join(*axel->conn[i]. |
| 11 | setup_thread, NULL); |
| 12 | @@ -687,7 +687,7 @@ |
| 13 | for (int i = 0; i < axel->conf->num_connections; i++) { |
| 14 | /* don't try to kill non existing thread */ |
| 15 | if (*axel->conn[i].setup_thread != 0) { |
| 16 | - pthread_cancel(*axel->conn[i].setup_thread); |
| 17 | + pthread_kill(*axel->conn[i].setup_thread, 0); |
| 18 | pthread_join(*axel->conn[i].setup_thread, NULL); |
| 19 | } |
| 20 | conn_disconnect(&axel->conn[i]); |
| 21 | @@ -770,9 +770,11 @@ |
| 22 | int oldstate; |
| 23 | |
| 24 | /* Allow this thread to be killed at any time. */ |
| 25 | +#ifndef __ANDROID__ |
| 26 | pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate); |
| 27 | pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); |
| 28 | |
| 29 | +#endif |
| 30 | pthread_mutex_lock(&conn->lock); |
| 31 | if (conn_setup(conn)) { |
| 32 | conn->last_transfer = gettime(); |