Info.Defer and regaining thread safety

I am under the impression that when you want to make an HTTP request as per the example, you do info.Defer() and then in the callback you do if deffered, info.Conitnue. This then probably makes it safe to do photon activity(Please correct me if I am wrong).

However what If i need a 2nd defer or do not want to continue but need to do logic. Example

2)Http request, defer
3)Callback received
4)Need to do stuff (cannot do continue here because we are in a fail or cancel situation but it is not determined yet which one it is)
5)Another http request(Do I defer again?)
6)Callback received
7)If all good: info.Cancel(because all messages are private I do not want them going to the other clients)
else info.Fail

So question 1) after a defer can you do stuff without calling cancel\continue etc
question 2) can you defer a 2nd time?
question 3) can you defer and then cancel to hide the message from other clients?



  • hi, @ZigzaTom

    Definitely, you should not call Defer the second time. Once will be enough. I do not see in code anything that could prevent you from doing what you want. So I think it is safe to call second http request and call cancel or fail in second callback.

    Although I should admit we did not test such case.

  • Thanks, Thats how I set it up and so far no problems!
Sign In or Register to comment.