Add some simple tracing to help figure out the Constraint_Error in the echoserver

This commit is contained in:
R. Tyler Croy 2011-02-17 23:04:57 -08:00
parent 59716b5ba8
commit 87945ca59c
2 changed files with 17 additions and 1 deletions

View File

@ -4,6 +4,10 @@
--
private with Ada.Text_IO;
use Ada.Text_IO;
package body Async.Epoll is
procedure Register (This : in out Hub;
@ -13,6 +17,8 @@ package body Async.Epoll is
begin
Validate_Hub (This);
This.Debug_Trace ("<Register>> The Hub is valid");
if Descriptor <= 0 then
raise Invalid_Descriptor;
end if;
@ -28,8 +34,13 @@ package body Async.Epoll is
if Status = -1 then
raise Descriptor_Registration_Falied;
end if;
This.Debug_Trace ("<Register>> Successfully added to the Epoll_Fd");
end;
This.Debug_Trace ("<Register>> Inserting descriptor:" &
Natural'Image (Natural (descriptor)));
Callback_Registry.Insert (This.Callbacks, Natural(Descriptor), Cb);
end Register;
@ -91,18 +102,22 @@ package body Async.Epoll is
procedure Validate_Hub (H : in Hub) is
begin
Debug_Trace (H, "Entering Validate_Hub");
if H.Epoll_Fd < 0 then
raise Hub_Invalid;
end if;
end Validate_Hub;
procedure Enable_Tracing (H : in out Hub) is
begin
H.Debug := True;
end Enable_Tracing;
procedure Debug_Trace (H : in Hub; Line : in String) is
begin
if not H.Debug then
return;
end if;
Put_Line (Line);
end Debug_Trace;
end Async.Epoll;

View File

@ -34,6 +34,7 @@ package Async.Epoll is
procedure Run (This : in Hub);
function Create return Hub;
procedure Enable_Tracing (H : in out Hub);
Hub_Create_Failed : exception;
Hub_Invalid : exception;