src/sock_gnutls.c
changeset 28 9c1050bc8709
parent 27 e6639132bead
child 29 3f0f2898fea3
equal deleted inserted replaced
27:e6639132bead 28:9c1050bc8709
   123     
   123     
   124     // ok... wait
   124     // ok... wait
   125     return SUCCESS;
   125     return SUCCESS;
   126 }
   126 }
   127 
   127 
       
   128 static void sock_gnutls_release (struct sock_stream *base_sock)
       
   129 {
       
   130     struct sock_gnutls *sock = SOCK_FROM_BASE(base_sock, struct sock_gnutls);
       
   131 
       
   132     // close the session rudely
       
   133     // XXX: does this actually do everything we need it to? Don't want to call gnutls_bye here, since we're void...
       
   134     gnutls_deinit(sock->session);
       
   135     
       
   136     // terminate the TCP transport
       
   137     sock_tcp_close(SOCK_GNUTLS_TCP(sock));
       
   138 
       
   139     // free
       
   140     free(sock);
       
   141 }
       
   142 
   128 /*
   143 /*
   129  * Our sock_stream_Type
   144  * Our sock_stream_Type
   130  */
   145  */
   131 struct sock_stream_type sock_gnutls_type = {
   146 struct sock_stream_type sock_gnutls_type = {
   132     .methods                = {
   147     .methods                = {
   133         .read               = &sock_gnutls_read,
   148         .read               = &sock_gnutls_read,
   134         .write              = &sock_gnutls_write,
   149         .write              = &sock_gnutls_write,
   135         .event_init         = &sock_gnutls_event_init,
   150         .event_init         = &sock_gnutls_event_init,
   136         .event_enable       = &sock_gnutls_event_enable,
   151         .event_enable       = &sock_gnutls_event_enable,
       
   152         .release            = &sock_gnutls_release,
   137     },
   153     },
   138 };
   154 };
   139 
   155 
   140 /*
   156 /*
   141  * XXX: global shared sock_gnutls_ctx
   157  * XXX: global shared sock_gnutls_ctx