comparison Platforms/Generic/WebServiceCommandBase.cpp @ 377:8eb4fe74000f

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 Nov 2018 16:18:27 +0100
parents 14ef1227120f
children aee3d7941c9b
comparison
equal deleted inserted replaced
376:70256a53ff21 377:8eb4fe74000f
47 } 47 }
48 48
49 49
50 void WebServiceCommandBase::Commit() 50 void WebServiceCommandBase::Commit()
51 { 51 {
52 NativeStoneApplicationContext::GlobalMutexLocker lock(context_); // we want to make sure that, i.e, the UpdateThread is not triggered while we are updating the "model" with the result of a WebServiceCommand 52 // We want to make sure that, i.e, the UpdateThread is not
53 // triggered while we are updating the "model" with the result of
54 // a WebServiceCommand
55 NativeStoneApplicationContext::GlobalMutexLocker lock(context_);
53 56
54 if (success_ && successCallback_.get() != NULL) 57 if (success_ && successCallback_.get() != NULL)
55 { 58 {
56 successCallback_->Apply(IWebService::HttpRequestSuccessMessage(uri_, answer_.c_str(), answer_.size(), payload_.release())); 59 IWebService::HttpRequestSuccessMessage message(uri_, answer_.c_str(), answer_.size(), payload_.get());
60 successCallback_->Apply(message);
57 } 61 }
58 else if (!success_ && failureCallback_.get() != NULL) 62 else if (!success_ && failureCallback_.get() != NULL)
59 { 63 {
60 failureCallback_->Apply(IWebService::HttpRequestErrorMessage(uri_, payload_.release())); 64 IWebService::HttpRequestErrorMessage message(uri_, payload_.get());
65 failureCallback_->Apply(message);
61 } 66 }
62
63 } 67 }
64
65 } 68 }