diff seobeo/s_linux_network.c @ 19:875bb6e10db7

[Seobeo] Chaning Function naming to be easily readable.
author June Park <parkjune1995@gmail.com>
date Mon, 06 Oct 2025 09:55:34 -0700
parents fa2b8af609d9
children 947b81010aba
line wrap: on
line diff
--- a/seobeo/s_linux_network.c	Mon Oct 06 08:21:34 2025 -0700
+++ b/seobeo/s_linux_network.c	Mon Oct 06 09:55:34 2025 -0700
@@ -76,8 +76,8 @@
   Seobeo_PHandle p_handle;
   p_handle = malloc(sizeof(*p_handle));
 
-  struct addrinfo hints, *server_infos, *free_server_info;
-  int32 socket_fd, yes = 1;  // Need this for setsockopt 
+  struct addrinfo hints, *server_infos;
+  int32 socket_fd;  // Need this for setsockopt 
 
   memset(&hints, 0, sizeof hints);
   hints.ai_family   = AF_UNSPEC;
@@ -100,7 +100,7 @@
   if (use_tls)
   {
     printf("USE SSL\n\n");
-    init_openssl();
+    Seobeo_Web_SSL_Init();
     p_handle->ssl_ctx = SSL_CTX_new(TLS_client_method());
     SSL_CTX_set_default_verify_paths(p_handle->ssl_ctx);
 
@@ -143,7 +143,7 @@
   return p_handle;
 }
 
-Seobeo_PHandle Seobeo_Stream_Handle_Accept(Seobeo_PHandle p_server_handle)
+Seobeo_PHandle Seobeo_Stream_Handle_Server_Accept(Seobeo_PHandle p_server_handle)
 {
   struct sockaddr_storage addr;
   socklen_t addrlen = sizeof addr;
@@ -153,7 +153,7 @@
                          &addrlen);
   inet_ntop(
       addr.ss_family,
-      Seobeo_GetIP4OrIP6((struct sockaddr *)&addr),
+      Seobeo_Get_IP4_Or_IP6((struct sockaddr *)&addr),
       client_inet_addr, sizeof client_inet_addr);
 
   if (client_fd == -1)
@@ -200,9 +200,25 @@
 
   if (p_handle->host) free(p_handle->host);
   if (p_handle->port) free(p_handle->port);
+
+  if (p_handle->ssl)
+  {
+    SSL_shutdown(p_handle->ssl);
+    SSL_free(p_handle->ssl);
+    p_handle->ssl = NULL;
+  }
+
+  if (p_handle->ssl_ctx)
+  {
+    SSL_CTX_free(p_handle->ssl_ctx);
+    p_handle->ssl_ctx = NULL;
+  }
+
   if (p_handle->socket) close(p_handle->socket);
+
   if (p_handle->read_buffer) free(p_handle->read_buffer);
   if (p_handle->write_buffer) free(p_handle->write_buffer);
+
   if (p_handle->text_copy) free(p_handle->text_copy);
   if (p_handle->file_name) free(p_handle->file_name);
 
@@ -368,7 +384,7 @@
   p_handle->read_buffer_len -= consumed;
 }
 
-void *Seobeo_GetIP4OrIP6(struct sockaddr *sa)
+void *Seobeo_Get_IP4_Or_IP6(struct sockaddr *sa)
 {
   if (sa->sa_family == AF_INET) 
   {