src/sock_gnutls.c
changeset 9 4c4c906cc649
parent 5 a09a0797f6f0
child 10 9fe218576d13
equal deleted inserted replaced
8:be88e543c8ff 9:4c4c906cc649
     1 
     1 
     2 #include "sock_gnutls.h"
     2 #include "sock_gnutls.h"
     3 
     3 
     4 #include <stdlib.h>
     4 #include <stdlib.h>
     5 #include <err.h>
     5 #include <err.h>
     6 
       
     7 static void _sock_gnutls_error (struct sock_gnutls *sock, const char *func, int _err) {
       
     8     if (_err == GNUTLS_E_FATAL_ALERT_RECEIVED)
       
     9         errx(1, "%s: %s: %s", func, gnutls_strerror(_err), gnutls_alert_get_name(gnutls_alert_get(sock->session)));
       
    10 
       
    11     else
       
    12         errx(1, "%s: %s", func, gnutls_strerror(_err));
       
    13 }
       
    14 
     6 
    15 static err_t sock_gnutls_read (struct sock_stream *base_sock, void *buf, size_t len)
     7 static err_t sock_gnutls_read (struct sock_stream *base_sock, void *buf, size_t len)
    16 {
     8 {
    17     struct sock_gnutls *sock = SOCK_FROM_BASE(base_sock, struct sock_gnutls);
     9     struct sock_gnutls *sock = SOCK_FROM_BASE(base_sock, struct sock_gnutls);
    18     
    10