In OPENSSL , After SSL_Connect() i am getting SSL_ERROR_WANT_READ - android

I am using SSL_Connect() and return code is "-1" , with SSL_get_error() i can see that error is SSL_ERROR_WANT_READ.
As per suggestion on one forum, where it suggested to keep calling SSL_connect() until this error goes. With this modification for first call i am getting error WANT_READ and for second call i am getting SSL_ERROR_SSL. After that for all subsequent calls it is SSL_ERROR_SSL only and as per description of this error it looks something went wrong in SSL library.
Can some one who resolved SSL_connect successfully provide some help.
My code is a plain sequence of calling :
1. SSL_library_init()
2. Creating methods(v23) and context using this meth
3. context has not been modified and it plain as created.
4. SSL object is created using this plain ctx and ssl_connect is called on this ssl after calling SSL_set_fd()
Please let me know if i am doing some thing wrong in this sequence or if i am missing something ?
Is it required to load various things to ctx like certificates and verify locations before using it , if yes what are the bare minimum things required.
Thanks in advance for help.

If it wants a read you have to do a read, or block in select() until OP_READ fires if non-blocking, and then call SSL_Connect() again.
If it wants a write you have to do a write, or block in select() until OP_WRITE fires if non-blocking, and then call SSL_Connect() again.
See here.

Related

Pass custom variable to Bitrise flow through the API

I am setting up a Bitrise on an Android app. I have everything set that is related to the flow, the thing is that I have a custom python builder which requires a parameter. My build-flow is triggered through API, which is working as expected - the only thing missing is passing that parameter to the build script.
What I have currently:
I have added an env-variable; named PARAM
My JSON body, that triggers the build
{
"hook_info":{
"type":"bitrise"
},
"build_params":{
"branch":"master",
"workflow_id":"test_args_script",
"commit_message":"Triggered from postman",
"environments":[
{
"mapped_to":"PARAM",
"value":"123456",
"is_expand":true
}
]
}
}
On the Bitrise flow I have a script step which is actually calling the python script as follows: python builder.py $PARAM
EXPECTATIONS:
My expectations are that the value that will be passed to the script will be the same as the one in the API payload (123456).
If anyone has recently worked on something similar, or if any of you guys can point me out to documentation that will help me to achieve the above I will be really thankful!
I actually found the way. The problem on my end was that I had an env-variable already named the same as the one variable that has been passed from the API. After changing the name to a different one, I was able to get the parameter and pass it to the build script. If anyone needs more info, give me a shout and I can post the payload along with the flow settings.

Android FireBase OnDataChange code not being permanant

enter image description here
I get the followingg Toast outputs
CODE IS RUNNING
and
s
So my code is running but my_shop is not being changed?
Your code is working fine, I think you are a bit confused as to how the code above actually works. the onDataChanged method is triggered/called asynchronously ONLY when the data in the database/server changes, hence the toast-'CODE IS RUNNING' is displayed correctly.
But you are checking the my_shop.getShop_name() outside the onDataChanged method, hence by the time the program counter reaches the second toast, the onDataChanged method hasn't been called yet. The shop_name is still the one that you assigned in line 2 which is what is displayed on the Toast! (which is why you think the code isn't running properly even if it is working fine!)
I would suggest you read more about event listeners in general to get a better idea abouut this behaviour! you can read more about the API in the firebase documentation: https://firebase.google.com/docs/database/android/read-and-write

'this#ActivityName' is not captured error Android/Kotlin

I'm repairing my friend's code and got confused.
My friend wants to fetch entered text (in EditText). Seems easy, right? Well, it is but instead of user input, he gets this warning/error:
To be honest I'm not sure how to fix it. He is coding in Kotlin (Android 10).
Activity that contains EditText:
And XML:
This is how it looks when debugging:
The app started working just fine after running "File -> invalidate Cashes/Restart" option, I just don't understand where this warning came from and how to fix it because the error remained unchanged (even though the app works). Do you have an idea how to solve it?
All the best!
fyi lambda expression like setOnClickListener from kotlin is not debuggable, see here.
if you want to debug variables inside setOnClickListener you should use the normal one e.g. setOnClickListener(object: View.OnClickListener {..})
sometimes there will be problem in auto generated binding files, if so it will be solved after invalidate cache and restart ide. sometimes the warning/error show but the project and complied without errors. so no need to worry about that. for next time post the code as code not screen shots.
I understand that the question is regarding evaluating expression, but there is a way you can read variables from your debugger console, even if you're inside an anonymous callback. I found it helpful sometimes. Here are the steps:
First enter debugger mode inside of your anonymous callback,
In your debugger console, look at the right side for "Frames"
Within Frames under , you'll see stack of function execution first top one on the list is the latest:
Click on row(s) below the latest function, until you find an instance of your activity AddInformationActivity. You will see the activity instance on the right side window under Variables. Don't go as far as selecting functions browned out, because those are from internal libraries.
When you see you AddInformationActivity instance, you can expand it and see its variables.
Hope that helps!
It's not a beautiful way, but if you create a method like this:
private fun debug() {
println()
}
and add a breakpoint on the println() it'll capture the activity.
(Don't use TODO as it'll crash the app with a NotImplementedError once called.)
I have this method now in my code all the time to call it whenever I need it.
I know, that question is old, but I just stumbled over it and needed a way.

Is there a way to trace who invoked onNext() on a Subject, in RxJava(2)?

I am developing an Android app (It doesn't matter though) using RxJava2, and in some singleton there are some PublishProcessors.
And there are a lot of .onNext() calls on these PublishProcessors all over the project.
Now in order to debug, I need to know, on every .onNext() called, which line in my project invoked this .onNext().
Is there a way in RxJava(2) that I can achieve this?
I think you can use Frames tab in Debug menu.
For example, in this case, MainActivity line 18 trigger onNext
Ah, thanks to #PhanVanLinh, I found a solution that worked for me.
(Actually it has pretty much nothing to do with RxJava...)
You just need to print the stacktrace using Thread.currentThread.stackTrace and print it to your own string inside doOnNext(), but remember to do it before .observeOn() so that the thread won't switch, it must stay at the original thread that called .onNext(), otherwise you won't get meaningful information.
Then you will know which line that called .onNext().

Add a warning if a method is not called in a specific class

So, what I'd like to achieve is:
I have a custom class which is basically a HttpRequest, I create the object with url, parameters, etc. And then I have to call execute() to execute it.
I was wondering, is there a way - by annotations, or whatever - to make Android Studio remind me to call this method?
I remember the was something similar with the android Toast, in the IDE a message like 'Did you forget to call show?' was shown if, in fact, I forgot to call show() after creating the Toast.
Thanks much to anyone who will help :)
You could try to create
Create a custom IntelliJ inspection
A custom LINT rule, if you want to check it on your build server and not on your local machine.

Categories

Resources