You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While reviewing code for PR 209, I noticed the following function aws-net-websocket-registry.adb:
procedure Watch (WebSocket : Object_Class) is
begin
if Is_Registered (WebSocket.Id)
and then not Watched.Contains (WebSocket.Id)
then
Watched.Insert (WebSocket.Id);
Count := Count + 1;
Signal_Socket;
end if;
exception
when others =>
Unregister (WebSocket);
raise;
end Watch;
It is slightly un-optimal since it needs to do two lookups when the socket is not watched yet. Perhaps something like the following would be more efficient:
procedure Watch (WebSocket : Object_Class) is
Inserted : Boolean;
Pos : WebSocket_Set.Cursor;
begin
if Is_Registered (WebSocket.Id) then
Watched.Insert (WebSocket.Id, Pos, Inserted);
if Inserted then
Count := Count + 1;
Signal_Socket;
end if;
end if;
exception
when others =>
-- ??? Not clear why we would unregister the socket here ?
-- also, it is possible that it is still in Watched at this point, and given the first test in this procedure this
-- might be unexpected behavior.
Unregister (WebSocket);
raise;
end Watch;
The text was updated successfully, but these errors were encountered:
While reviewing code for PR 209, I noticed the following function aws-net-websocket-registry.adb:
It is slightly un-optimal since it needs to do two lookups when the socket is not watched yet. Perhaps something like the following would be more efficient:
The text was updated successfully, but these errors were encountered: