tests: wip
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
diff --git a/lib/kc3/0.1/http/event.kc3 b/lib/kc3/0.1/http/event.kc3
index eb3b1e9..60f40a7 100644
--- a/lib/kc3/0.1/http/event.kc3
+++ b/lib/kc3/0.1/http/event.kc3
@@ -11,8 +11,8 @@ defmodule HTTP.Event do
def dispatch = cfn S32 "event_base_dispatch" (Ptr)
- # init() returns a (struct event_base *)
- def event_base_new = cfn Ptr "event_base_new" ()
+ # base_new() returns a (struct event_base *)
+ def base_new = cfn Ptr "event_base_new" ()
def new = cfn Ptr "http_event_new" (Ptr, S32, List, Fn, Tag)
diff --git a/test/http/07_event_echo.kc3 b/test/http/07_event_echo.kc3
index 97d367e..866468a 100644
--- a/test/http/07_event_echo.kc3
+++ b/test/http/07_event_echo.kc3
@@ -1,5 +1,5 @@
timeout = %Time{tv_sec: (Sw) 300}
-event_base = HTTP.Event.init()
+event_base = HTTP.Event.base_new()
socket = Socket.listen("0.0.0.0", "57000")
echo_client = fn (socket, events, client_ev, client) do
if List.has?(events, :read) && List.has(events, :write) do
@@ -11,7 +11,7 @@ end
acceptor = fn (server_socket, events, acceptor_ev, void) do
if List.has?(events, :read) do
client = Socket.Buf.accept(server_socket)
- client_ev = HTTP.Event.new(client.sockfd, [:read, :write],
+ client_ev = HTTP.Event.new(event_base, client.sockfd, [:read, :write],
echo_client, client)
puts(client_ev)
HTTP.Event.base_set(event_base, client_ev)
@@ -19,11 +19,11 @@ acceptor = fn (server_socket, events, acceptor_ev, void) do
end
end
puts(socket.fd)
-acceptor_ev = HTTP.Event.new(socket.fd, [:read], acceptor,
+acceptor_ev = HTTP.Event.new(event_base, socket.fd, [:read], acceptor,
void)
puts(HTTP.Event.base_set(event_base, acceptor_ev))
puts(HTTP.Event.add(acceptor_ev, timeout))
-r = HTTP.Event.dispatch()
+r = HTTP.Event.dispatch(event_base)
if r do
e = errno()
puts("HTTP.Event.dispatch: #{r}: #{strerror(e)}")