diff --git a/src/core/auth.c b/src/core/auth.c index 707ab1d..8f8ffe9 100644 --- a/src/core/auth.c +++ b/src/core/auth.c @@ -26,12 +26,10 @@ static int check_cmd_bool(const char* cmd, struct linked_list* list, char* line, int line_count) { char* data; - char* data_extra; if (!strncmp(line, cmd, strlen(cmd))) { data = &line[strlen(cmd)]; - data_extra = 0; data[0] = '\0'; data++; diff --git a/src/core/hub.h b/src/core/hub.h index f7453c3..5f8581b 100644 --- a/src/core/hub.h +++ b/src/core/hub.h @@ -119,7 +119,7 @@ struct hub_info #endif #ifdef SSL_SUPPORT - SSL_METHOD* ssl_method; + const SSL_METHOD* ssl_method; SSL_CTX* ssl_ctx; #endif /* SSL_SUPPORT */ }; diff --git a/src/network/connection.c b/src/network/connection.c index 3bf72c9..748683b 100644 --- a/src/network/connection.c +++ b/src/network/connection.c @@ -70,7 +70,6 @@ static int handle_openssl_error(struct net_connection* con, int ret) con->ssl_state = tls_st_error; return -1; } - return -1; } diff --git a/src/tools/adcclient.c b/src/tools/adcclient.c index 93bb666..7217720 100644 --- a/src/tools/adcclient.c +++ b/src/tools/adcclient.c @@ -1,6 +1,6 @@ /* * uhub - A tiny ADC p2p connection hub - * Copyright (C) 2007-2009, Jan Vidar Krey + * Copyright (C) 2007-2011, Jan Vidar Krey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,33 +75,32 @@ static void event_callback(struct net_connection* con, int events, void *arg) { struct ADC_client* client = (struct ADC_client*) net_con_get_ptr(con); - if (events == NET_EVENT_TIMEOUT) + switch (client->state) { - if (client->state == ps_conn) - { - client->callback(client, ADC_CLIENT_DISCONNECTED, 0); - } - return; - } + case ps_conn: + if (events == NET_EVENT_TIMEOUT) + { + client->callback(client, ADC_CLIENT_DISCONNECTED, 0); + return; + } - if (events & NET_EVENT_READ) - { - if (ADC_client_recv(client) == -1) - { - ADC_client_on_disconnected(client); - } - } + if (events & NET_EVENT_WRITE) + ADC_client_connect(client, 0); + break; - if (events & NET_EVENT_WRITE) - { - if (client->state == ps_conn) - { - ADC_client_connect(client, 0); - } - else - { - /* FIXME: Call send again */ - } + default: + if (events & NET_EVENT_READ) + { + if (ADC_client_recv(client) == -1) + { + ADC_client_on_disconnected(client); + } + } + + if (events & NET_EVENT_WRITE) + { + /* FIXME: Call send again */ + } } } @@ -380,6 +379,14 @@ int ADC_client_connect(struct ADC_client* client, const char* address) int ret = net_connect(net_con_get_sd(client->con), (struct sockaddr*) &client->addr, sizeof(struct sockaddr_in)); if (ret == 0 || (ret == -1 && net_error() == EISCONN)) { +#ifdef SSL_SUPPORT + if (ssl_enabled) + { + + } + else +#endif + ADC_client_on_connected(client); } else if (ret == -1 && (net_error() == EALREADY || net_error() == EINPROGRESS || net_error() == EWOULDBLOCK || net_error() == EINTR)) @@ -446,9 +453,9 @@ static int ADC_client_parse_address(struct ADC_client* client, const char* arg) /* Check for ADC or ADCS */ if (!strncmp(arg, "adc://", 6)) - ssl = 0; + client->ssl_enabled = 0; else if (!strncmp(arg, "adcs://", 7)) - ssl = 1; + client->ssl_enabled = 1; else return 0; diff --git a/src/tools/adcclient.h b/src/tools/adcclient.h index 3b49a3e..39c71dc 100644 --- a/src/tools/adcclient.h +++ b/src/tools/adcclient.h @@ -1,6 +1,6 @@ /* * uhub - A tiny ADC p2p connection hub - * Copyright (C) 2007-2010, Jan Vidar Krey + * Copyright (C) 2007-2011, Jan Vidar Krey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,6 +115,11 @@ struct ADC_client char* hub_address; char* nick; char* desc; + int ssl_enabled; +#ifdef SSL_SUPPORT + SSL_METHOD* ssl_method; + SSL_CTX* ssl_ctx; +#endif /* SSL_SUPPORT */ }; int ADC_client_create(struct ADC_client* client, const char* nickname, const char* description); diff --git a/src/tools/adcrush.c b/src/tools/adcrush.c index e54f502..26c05a0 100644 --- a/src/tools/adcrush.c +++ b/src/tools/adcrush.c @@ -328,9 +328,8 @@ void runloop(size_t clients) ADC_client_connect(c, cfg_uri); } - while (running) + while (net_backend_process()) { - net_backend_process(); } for (n = 0; n < clients; n++) diff --git a/version.h b/version.h index 6fbe8a4..47b5eb3 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,6 @@ +#if !defined(_MSC_VER) #include "revision.h" +#endif #ifndef PRODUCT #define PRODUCT "uhub"