altcp_tls: rename altcp_tls_new -> altcp_tls_wrap, add altcp_tls_new

The new altcp_tls_new() is a type safe version of altcp_tls_alloc()

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Simon Goldschmidt
2018-09-24 22:29:54 +02:00
parent 6229f9ef71
commit a044c807f8
7 changed files with 38 additions and 35 deletions

View File

@@ -460,18 +460,15 @@ smtp_setup_pcb(struct smtp_session *s, const ip_addr_t* remote_ip)
struct altcp_pcb* pcb;
LWIP_UNUSED_ARG(remote_ip);
pcb = altcp_tcp_new_ip_type(IP_GET_TYPE(remote_ip));
if (pcb != NULL) {
#if LWIP_ALTCP && LWIP_ALTCP_TLS
if (smtp_server_tls_config) {
struct altcp_pcb *pcb_tls = altcp_tls_new(smtp_server_tls_config, pcb);
if (pcb_tls == NULL) {
altcp_close(pcb);
return NULL;
}
pcb = pcb_tls;
}
if (smtp_server_tls_config) {
pcb = altcp_tls_new(smtp_server_tls_config, IP_GET_TYPE(remote_ip));
} else
#endif
{
pcb = altcp_tcp_new_ip_type(IP_GET_TYPE(remote_ip));
}
if (pcb != NULL) {
altcp_arg(pcb, s);
altcp_recv(pcb, smtp_tcp_recv);
altcp_err(pcb, smtp_tcp_err);