mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Check that TCP connections aren't dropped in callbacks.
They aren't, but it's unclear whether it's structurally impossible.
This commit is contained in:
parent
958aa43bdf
commit
583d71680e
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
struct TCP_Connections {
|
struct TCP_Connections {
|
||||||
DHT *dht;
|
DHT *dht;
|
||||||
|
@ -1397,6 +1399,9 @@ static void do_tcp_conns(TCP_Connections *tcp_c, void *userdata)
|
||||||
/* callbacks can change TCP connection address. */
|
/* callbacks can change TCP connection address. */
|
||||||
tcp_con = get_tcp_connection(tcp_c, i);
|
tcp_con = get_tcp_connection(tcp_c, i);
|
||||||
|
|
||||||
|
// Make sure the TCP connection wasn't dropped in any of the callbacks.
|
||||||
|
assert(tcp_con != NULL);
|
||||||
|
|
||||||
if (tcp_con->connection->status == TCP_CLIENT_DISCONNECTED) {
|
if (tcp_con->connection->status == TCP_CLIENT_DISCONNECTED) {
|
||||||
if (tcp_con->status == TCP_CONN_CONNECTED) {
|
if (tcp_con->status == TCP_CONN_CONNECTED) {
|
||||||
reconnect_tcp_relay_connection(tcp_c, i);
|
reconnect_tcp_relay_connection(tcp_c, i);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user