- This topic has 9 replies, 2 voices, and was last updated 5 years, 1 month ago by
kimbomadsen.
-
AuthorPosts
-
-
September 30, 2020 at 01:51 #55112
Babis MichaelParticipantHello Kim,
Can you please add a overloaded GetLogin function with ActorName,
RoleName and Location as parameters like the below:function TkbmMWAuthorizationManager.GetLogin(AActorName:string;
ARoleName:string; ALocation:string):TkbmMWAuthorizationLogin;Currently you have only to get with LoginToken
Thank you
-
October 5, 2020 at 22:01 #55128
kimbomadsen
KeymasterHi,
You can use: authmgr.Logins.Get(AActorName:string; ARoleName:string; ALocation:string) or one of the other functions accessible via the Logins property.
best regards
Kim
-
October 6, 2020 at 16:05 #55138
Babis MichaelParticipantHello,
Well since i’m detecting when a connection disconnects (using Server’s trasnport disconnect event) after i logout the user using the following code:
//I create the actor at login and delete when disconnect/logout in order to save resources
//FLoginInfo is a record which hold the Actor’s username and RemoteLocationvLogin := AuthorizationManager.Logins.Get(FLoginInfo.ActorName, ‘USER’, FLoginInfo.RemoteLocation);
if Assigned(vLogin) then //Actor is logged but disconnected
begin
AuthorizationManager.Logout(vLogin.Token); //Delete the Actor’s login from AuthorizationManager
AuthorizationManager.DeleteActor(FLoginInfo.ActorName); //Delete the Actor from AuthorizationManager
end;The problem is when a massing drop of connections occurs i get AV on:
vLogin := AuthorizationManager.Logins.Get(FLoginInfo.ActorName, ‘USER’, FLoginInfo.RemoteLocation);
on the below line of TkbmMWAuthorizationLogins.Get:
if (n.Actor.Name=AActorName) and (n.Role.Name=ARoleName) and (n.Location=ALocation) thenLike it’s trying to get the AActorName on a non existant Actor. (It does not check if Actor/Role exists ?)
Any ideas ?
Thank you
-
October 8, 2020 at 22:02 #55157
kimbomadsen
KeymasterHi,
Do:authmgr.Lock.BeginRead;
try
authmgr.logins.Get(….)
finally
authmgr.Lock.EndRead;
end;Remember that the vlogin may go missing outside the beginread/endread section, due to other threads playing with the logins simultanously.
-
October 9, 2020 at 22:50 #55165
Babis MichaelParticipantHello,
Nope! if i delete the actor AV will occur! Removing DeleteActor no AV.try
authmgr.logins.Get(….) <– AV here
authmgr.logout(logintoken); //actor is logged so log him out
authmgr.deleteactor(actor); // actor is logged out so delete him
finally
authmgr.Lock.EndRead;
end;Thank you
-
October 11, 2020 at 17:19 #55166
Babis MichaelParticipantBelow is the correct code:
authmgr.Lock.BeginRead;
try
vlogin := authmgr.logins.Get(….) <– AV hereif assigned(vlogin) then
begin
authmgr.logout(vlogin,logintoken); //actor is logged so log him out
authmgr.deleteactor(actor); // actor is logged out so delete him
end;finally
authmgr.Lock.EndRead;
end;btw, shouldn’t the “DeleteActor” logout the user too ?
Thank you
-
October 15, 2020 at 13:27 #55174
kimbomadsen
KeymasterHi,
Try to change to BeginWrite/EndWrite instead and see if that solves the issue.
You could argue that DeleteActor and other Delete statements that removes the prerequisite for a login, should delete login instances. I will look into if it is viable.
best regards
Kim/C4D
-
October 18, 2020 at 18:27 #55176
Babis MichaelParticipantHello,
Nope, BeginWrite/EndWrite have the same result. Access violation!
I think the wrong locks should cause a deadlock and not an Access violation! <g>
I guess something is trying to acess something that it isn’t there any more after calling deleteactor but i haven’t figure out what! -
November 3, 2020 at 14:02 #55185
Babis MichaelParticipantHello,
I think i solved the problem! There were a couple machines with the same actorname so it caused the AV on the delete actor! Since i changed the duplicate actor name the AV seems to be gone when deleting the actor!
-
November 5, 2020 at 10:09 #55196
kimbomadsen
KeymasterOk.. .so you somehow get both actors (with same name) defined within the same authorization manager instance?
That could cause some issues, when dropping an actor again based on the name.
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.
