An extensible multi-threaded TCP/TLS socket library
git clone git://soophie.de/sock
1
CC=cc2
CFLAGS=-Wall -Wextra -Werror -pedantic3
CCHECK=-I. -x c - -fsyntax-only5
install:6
mkdir -p /usr/local/include/7
sudo cp src/sock.h /usr/local/include/9
check: src/sock.h10
@printf '#define SO_SOCK_IMPL\n#include "%s"' "$^" | $(CC) $(CFLAGS) $(CCHECK)
169
void sock_cleanup(sock_t *self) {170
if (self->binds != NULL) {171
for (size_t i = 0; i < self->binds_len; i++) {172
for (size_t j = 0; j < self->binds[i].hosts_len; j++) {172
for (size_t j = 0; j < (size_t) self->binds[i].hosts_len; j++) {173
if (self->binds[i].hosts[j].ssl_ctx != NULL) {174
SSL_CTX_free(self->binds[i].hosts[j].ssl_ctx);175
}
324
const char *hostname = SSL_get_servername(ssl, 0);325
if (hostname != NULL) {326
for (size_t i = 0; i < conn->sock->binds_len; i++) {327
for (size_t j = 0; j < conn->sock->binds[i].hosts_len; j++) {327
for (size_t j = 0; j < (size_t) conn->sock->binds[i].hosts_len; j++) {328
sock_host_t *sock_host = &conn->sock->binds[i].hosts[j];329
if (strcmp(sock_host->hostname, hostname) == 0) {330
conn->curr_host = sock_host;