Prechádzať zdrojové kódy

tls: test if conection is still active for peer verification

Daniel-Constantin Mierla 11 rokov pred
rodič
commit
458b803efa
1 zmenil súbory, kde vykonal 6 pridanie a 1 odobranie
  1. 6 1
      modules/tls/tls_mod.c

+ 6 - 1
modules/tls/tls_mod.c

@@ -400,7 +400,12 @@ static int is_peer_verified(struct sip_msg* msg, char* foo, char* foo2)
 
 
 	c = tcpconn_get(msg->rcv.proto_reserved1, 0, 0, 0,
 	c = tcpconn_get(msg->rcv.proto_reserved1, 0, 0, 0,
 					cfg_get(tls, tls_cfg, con_lifetime));
 					cfg_get(tls, tls_cfg, con_lifetime));
-	if (c && c->type != PROTO_TLS) {
+	if (!c) {
+		ERR("connection no longer exits\n");
+		return -1;
+	}
+
+	if(c->type != PROTO_TLS) {
 		ERR("Connection found but is not TLS\n");
 		ERR("Connection found but is not TLS\n");
 		tcpconn_put(c);
 		tcpconn_put(c);
 		return -1;
 		return -1;