I'm confused as to how this should /actually/ be set up

echoserver.adb:47:24: expected type "Context_Type" defined at async-epoll.ads:15
echoserver.adb:47:24: found type "Echo_State" defined at echo.ads:5
This commit is contained in:
R. Tyler Croy 2011-02-18 21:40:17 -08:00
parent 29d112af8d
commit 6dd93c3118
3 changed files with 16 additions and 3 deletions

View File

@ -2,13 +2,17 @@ with Ada.Text_IO,
GNAT.Sockets,
Async.Epoll;
use Ada.Text_IO;
use Ada.Text_IO,
GNAT.Sockets;
package body Echo is
procedure Call_Me_Back (Sock : GNAT.Sockets.Socket_Type;
procedure Call_Me_Back (Sock : Socket_Type;
Ctx : Async.Epoll.Context_Type) is
New_Sock : Socket_Type;
begin
Put_Line (">>> Starting Call_Me_Back");
Accept_Socket(Sock, New_Sock);
end Call_Me_Back;
end Echo;

View File

@ -2,6 +2,10 @@ with GNAT.Sockets;
with Async.Epoll;
package Echo is
type Echo_State is new Async.Epoll.Context_Type with record
Server_Addr : GNAT.Sockets.Sock_Addr_Type;
end record;
procedure Call_Me_Back (Sock : GNAT.Sockets.Socket_Type;
Ctx : Async.Epoll.Context_Type);
Ctx : Async.Epoll.Context_Type);
end Echo;

View File

@ -38,12 +38,17 @@ begin
declare
Ctx : Async.Epoll.Callback_Tuple;
State : Echo.Echo_State;
begin
The_Hub.Enable_Tracing;
State.Server_Addr := ServerAddr;
Ctx.Callback := Echo.Call_Me_Back'Access;
Ctx.Socket := ServerSock;
Ctx.Context := State;
The_Hub.Register (Ctx);
The_Hub.Run;
end;
return;
loop
Accept_Socket (ServerSock, ClientSock, ServerAddr);