Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement esp_close() and esp_shutdown()
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jan 26, 2015
1 parent 70d26b8 commit c823743
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 12 additions & 0 deletions esp.c
Expand Up @@ -332,8 +332,20 @@ int esp_mainloop(struct openconnect_info *vpninfo, int *timeout)

void esp_close(struct openconnect_info *vpninfo)
{
/* We close and reopen the socket in case we roamed and our
local IP address has changed. */
if (vpninfo->dtls_fd != -1) {
closesocket(vpninfo->dtls_fd);
unmonitor_read_fd(vpninfo, dtls);
unmonitor_write_fd(vpninfo, dtls);
unmonitor_except_fd(vpninfo, dtls);
}
}

void esp_shutdown(struct openconnect_info *vpninfo)
{
destroy_esp_ciphers(&vpninfo->esp_in[0]);
destroy_esp_ciphers(&vpninfo->esp_in[1]);
destroy_esp_ciphers(&vpninfo->esp_out);
esp_close(vpninfo);
}
5 changes: 0 additions & 5 deletions library.c
Expand Up @@ -257,11 +257,6 @@ void openconnect_vpninfo_free(struct openconnect_info *vpninfo)
#endif
#ifdef DTLS_GNUTLS
gnutls_free(vpninfo->gnutls_dtls_cipher);
#endif
#if defined(ESP_GNUTLS) || defined(ESP_OPENSSL)
destroy_esp_ciphers(&vpninfo->esp_in[0]);
destroy_esp_ciphers(&vpninfo->esp_in[1]);
destroy_esp_ciphers(&vpninfo->esp_out);
#endif
free(vpninfo->dtls_addr);

Expand Down

0 comments on commit c823743

Please sign in to comment.