Browse code

core: main - set default send tcp sockets to tls if no tcp is available

Daniel-Constantin Mierla authored on 11/09/2019 10:05:18
Showing 1 changed files
... ...
@@ -1567,12 +1567,20 @@ int main_loop(void)
1567 1567
 				/* get first ipv4/ipv6 socket*/
1568 1568
 				if ((si->address.af==AF_INET)&&
1569 1569
 						((sendipv4_tls==0) ||
1570
-							(sendipv4_tls->flags&(SI_IS_LO|SI_IS_MCAST))))
1570
+						 (sendipv4_tls->flags&(SI_IS_LO|SI_IS_MCAST)))) {
1571 1571
 					sendipv4_tls=si;
1572
+					if(sendipv4_tcp==0) {
1573
+						sendipv4_tcp=si;
1574
+					}
1575
+				}
1572 1576
 				if( ((sendipv6_tls==0) ||
1573 1577
 							(sendipv6_tls->flags&(SI_IS_LO|SI_IS_MCAST))) &&
1574
-						(si->address.af==AF_INET6))
1578
+						(si->address.af==AF_INET6)) {
1575 1579
 					sendipv6_tls=si;
1580
+					if(sendipv6_tcp==0) {
1581
+						sendipv6_tcp=si;
1582
+					}
1583
+				}
1576 1584
 			}
1577 1585
 		}
1578 1586
 #endif /* USE_TLS */