-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a few blocking/callback issues in the vault API #1486
Conversation
These callback parameters were ignored and no Python code defined a publicAgeCreated or publicAgeRemoved method. The public/private change notification is actually delivered as a plVaultNotifyMsg with type kPublicAgeCreated or kPublicAgeRemoved sent by VaultSetAgePublic.
My concern here is that I think I already made everything nonblocking that could possibly be done without deep surgery in the Python code. For example, a very casual grep reveals this, which implies that the device will be available when the function call returns, and the device is immediately used in the next few lines. From what I can tell, this would error when this PR is merged. Further, I'm fairly certain that we can't just make the Python API's Age registration functionality nonblocking for the same reason. IIRC this is because PelletBahroCave is registered somewhere, then its vault is accessed immediately thereafter. I was hoping to address this with #1149, but limited time. I'm also not sure I like the Python API becoming less featureful, even though those features may not be used anywhere at this time. |
Ah, you're right, I missed that - thanks. In this case, this can be fixed by moving the code from after the The only other
Yeah, I think that's one of the cases I noticed. That's why I didn't touch
The other unused functions I removed already have non-blocking alternatives (and those are used somewhere), so no functionality is lost there. |
Fixed the code in nb01DRCImager.py, but I have no way to test it. That script seems completely unused - the hood classroom imager also uses xSimpleImager.py. |
I was more worried about the dropping of a few |
I explained that in the commit message for 9b8523c - those parameters were already dead:
|
VaultAgeAddDevice
andVaultAgeSetDeviceInbox
to use callbacks instead of blocking.This is only the low-hanging fruit. The remaining blocking vault calls are much harder to fix.
Unfortunately, the vault API still uses C-style callbacks with
void* param
, so the non-blocking implementations are much less straightforward. This would probably be much nicer withstd::function
and lambdas.