Cleanup and added integrated tls config params parsing
This commit is contained in:
parent
16fff2fd51
commit
be293d72cd
16 changed files with 72 additions and 40 deletions
6
src/3rdparty/clib-net/include/net.h
vendored
6
src/3rdparty/clib-net/include/net.h
vendored
|
@ -9,7 +9,7 @@
|
|||
#include <uv.h>
|
||||
#include <buffer/buffer.h>
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
#include "tls.h"
|
||||
#endif
|
||||
|
||||
|
@ -43,7 +43,7 @@ typedef struct sockaddr_in socketPair_t;
|
|||
uv_tcp_t *handle; \
|
||||
uv_connect_t *conn; \
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
#define NET_TLS_FIELDS \
|
||||
int use_ssl; \
|
||||
int tls_established; \
|
||||
|
@ -71,7 +71,7 @@ net_t *
|
|||
net_new(char * hostname, int port);
|
||||
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
/*
|
||||
* Set SSL's Context
|
||||
*/
|
||||
|
|
12
src/3rdparty/clib-net/src/net.c
vendored
12
src/3rdparty/clib-net/src/net.c
vendored
|
@ -25,7 +25,7 @@ net_new(char * hostname, int port) {
|
|||
return net;
|
||||
}
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
int
|
||||
net_set_tls(net_t * net, tls_ctx * ctx) {
|
||||
net->use_ssl = USE_SSL;
|
||||
|
@ -47,7 +47,7 @@ net_close(net_t * net, void (*cb)(uv_handle_t*)) {
|
|||
net->connected = 0;
|
||||
net->tls_established = 0;
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
if (net->use_ssl) {
|
||||
tls_shutdown(net->tls);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ net_close(net_t * net, void (*cb)(uv_handle_t*)) {
|
|||
|
||||
uv_close((uv_handle_t*)net->handle, cb);
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
if (net->use_ssl) {
|
||||
tls_free(net->tls);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ net_connect_cb(uv_connect_t *conn, int err) {
|
|||
net->conn_cb(net);
|
||||
}
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
/*
|
||||
* Handle TLS Partial
|
||||
*/
|
||||
|
@ -246,7 +246,7 @@ net_read(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
/*
|
||||
* BIO Return rule:
|
||||
* All these functions return either the amount of data successfully
|
||||
|
@ -330,7 +330,7 @@ net_write2(net_t * net, char * buf, unsigned int len) {
|
|||
|
||||
switch (net->use_ssl) {
|
||||
case USE_SSL:
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
tls_write(net->tls, buf, (int)len);
|
||||
do {
|
||||
read = tls_bio_read(net->tls, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue