Commit 011506f4f5f5a8c4efd0e4337916676a4f93fea7

Thomas de Grivel 2024-07-26T20:01:12

fix http test 03_client_server

diff --git a/http/socket_buf.c b/http/socket_buf.c
index 0062749..a661e8a 100644
--- a/http/socket_buf.c
+++ b/http/socket_buf.c
@@ -23,8 +23,9 @@ void socket_buf_clean (s_socket_buf *sb)
 {
   assert(sb);
   close(sb->sockfd);
-  socket_addr_delete(sb->addr);
   buf_rw_clean(&sb->buf_rw);
+  if (sb->addr)
+    socket_addr_delete(sb->addr);
 }
 
 s_socket_buf * socket_buf_init (s_socket_buf *sb, t_socket sockfd,
diff --git a/test/http/03_client_server.kc3 b/test/http/03_client_server.kc3
index 8a2949c..4817cd0 100644
--- a/test/http/03_client_server.kc3
+++ b/test/http/03_client_server.kc3
@@ -1,9 +1,9 @@
 quote server = Socket.listen("localhost", "58000")
 server = Socket.listen("localhost", "58000")
-quote client = Socket.connect("localhost", "58000")
-client = Socket.connect("localhost", "58000")
-quote server_client = Socket.accept(server)
-server_client = Socket.accept(server)
+quote client = Socket.Buf.connect("localhost", "58000")
+client = Socket.Buf.connect("localhost", "58000")
+quote server_client = Socket.Buf.accept(server)
+server_client = Socket.Buf.accept(server)
 quote Socket.Buf.close(client)
 Socket.Buf.close(client)
 quote Socket.Buf.close(server_client)