-
Notifications
You must be signed in to change notification settings - Fork 402
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
don't rewrite .wpc file if session was not modified #375
base: master
Are you sure you want to change the base?
Conversation
what's the problem with rewriting the session file? |
Main reason is to avoid unnecessary IO on the disk. Today many routers one day is easy to complete WPS transaction, but another day, I don't even know what is going on, WPS transaction fails, usually got timeout. Every 5 attempts, no matter if WPS transaction has completed or not, is called the save_session().
Nothing complex. The build_session_sign() is called in the restore_session() and the save_session(). The restore_session() is called only at the beginning of the program and the save_session() is called every 5 attempts and end of the program. malloc/free is necessary for C 😅 |
well, the commit adds 51 lines for something that can (maybe) be done in 3-6.
not necessarily. there are other ways to manage memory, especially if it's of a fixed small size like here. i'd rather put a char[32] into the globule struct then allocating/freeing the entire time. for local use, a stack buffer (or in C lingua "automatic variable") is preferable. |
And now, has it gotten better? |
yeah, a lot better, dont you think yourself ? now if you could put the snprintf calls into a |
src/session.c
Outdated
@@ -424,3 +439,9 @@ int jump_p2_queue(char* value) | |||
|
|||
return ret_val; | |||
} | |||
|
|||
static void make_session_signature(char* out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you put this before the first calling site, you dont need to declare it in session.h or anywhere else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified
To avoid rewriting the same .wpc file without having modified the session