diff options
| author | Anton <anton@picapica> | 2018-12-14 22:41:27 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2018-12-14 22:41:27 +0400 |
| commit | 0b6656e30c83a328e2b70c0802584e98b1da0a40 (patch) | |
| tree | 44000a140f54a26310eb95b3ee24741f40df9955 /PICA_nodewait.c | |
| parent | 240d089596ff9727ba257e539b88584d6fa6a9f9 (diff) | |
| download | pica-pica-0b6656e30c83a328e2b70c0802584e98b1da0a40.tar.gz pica-pica-0b6656e30c83a328e2b70c0802584e98b1da0a40.zip | |
pica-node: implemented anon DH TLS connection stage, reworked newconns
Diffstat (limited to 'PICA_nodewait.c')
| -rw-r--r-- | PICA_nodewait.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/PICA_nodewait.c b/PICA_nodewait.c index 6bae525..c2467e1 100644 --- a/PICA_nodewait.c +++ b/PICA_nodewait.c @@ -162,6 +162,22 @@ static void *nodewait_connect_thread (void *arg) } else { + nw->nc.anonssl = SSL_new(anon_ctx); + + if (!nw->nc.anonssl) + { + CLOSE(nw->nc.sck); + return (void *)0; + } + + if (!SSL_set_fd(nw->nc.anonssl, nw->nc.sck) || 1 != SSL_connect(nw->nc.anonssl)) + { + SSL_free(nw->nc.anonssl); + CLOSE(nw->nc.sck); + ap = ap->ai_next; + continue; + } + break; } } @@ -171,11 +187,11 @@ static void *nodewait_connect_thread (void *arg) nw->nc.addr = *((struct sockaddr_in*)(ap->ai_addr)); nw->state = PICA_NODEWAIT_CONNECTED; - return 1; + return (void *)1; } nw->state = PICA_NODEWAIT_CONNECT_FAILED; - return 0; + return (void *)0; } void nodewait_start_resolve(struct PICA_nodeaddr *a) |
