Merge lp://qastaging/~marcustomlinson/unity-scopes-api/switch-to-net-cpp into lp://qastaging/unity-scopes-api

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 195
Merged at revision: 282
Proposed branch: lp://qastaging/~marcustomlinson/unity-scopes-api/switch-to-net-cpp
Merge into: lp://qastaging/unity-scopes-api
Prerequisite: lp://qastaging/~saviq/unity-scopes-api/fix-cross-wrap
Diff against target: 1370 lines (+357/-698)
19 files modified
CMakeLists.txt (+27/-47)
debian/control (+1/-1)
include/unity/scopes/OnlineAccountClient.h (+1/-1)
include/unity/scopes/internal/smartscopes/HttpClientInterface.h (+1/-1)
include/unity/scopes/internal/smartscopes/HttpClientNetCpp.h (+78/-0)
include/unity/scopes/internal/smartscopes/HttpClientQt.h (+0/-91)
include/unity/scopes/internal/smartscopes/HttpClientQtThread.h (+0/-100)
src/scopes/internal/JsonCppNode.cpp (+4/-4)
src/scopes/internal/RegistryObject.cpp (+1/-1)
src/scopes/internal/smartscopes/CMakeLists.txt (+2/-31)
src/scopes/internal/smartscopes/HttpClientNetCpp.cpp (+189/-0)
src/scopes/internal/smartscopes/HttpClientQt.cpp (+0/-151)
src/scopes/internal/smartscopes/HttpClientQtThread.cpp (+0/-186)
src/scopes/internal/smartscopes/SSRegistryObject.cpp (+2/-2)
src/scopes/internal/smartscopes/SmartScopesClient.cpp (+41/-30)
test/gtest/scopes/internal/smartscopes/HttpClient/HttpClient_test.cpp (+3/-3)
test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py (+4/-1)
test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp (+3/-2)
valgrind-suppress (+0/-46)
To merge this branch: bzr merge lp://qastaging/~marcustomlinson/unity-scopes-api/switch-to-net-cpp
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michi Henning Pending
Review via email: mp+246982@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2015-01-15.

Commit message

Switch from QNetwork to net-cpp

Description of the change

Switch from QNetwork to net-cpp

This change has been on our backlog for some time now (Bug #1326816), but due to a recent issue we started experiencing with QNetwork (Bug #1409995) we are taking the opportunity now to make the switch over to net-cpp.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Michi Henning (michihenning) wrote : Posted in a previous version of this proposal

Looks good, thanks!

A few minor quibbles:

Please don't use uint anywhere. It's not a C++ type, and whether it works or not depends on whether some random header happens to drag in sys/types.h. Use unsigned int instead. (uint also causes warnings from doxygen when building the developer doc because it ends up not being able to match the signature in some cases.)

And, as an aside, try to not use unsigneds at all. They are evil. (See John Lakos for a really good explanation.)

76 + explicit HttpClientNetCpp(uint no_reply_timeout);
86 + void cancel_get(uint session_id) override;
88 + uint no_reply_timeout;
416 + std::pair<uint, std::shared_ptr<Cancelable>> add()
424 + uint add(const std::shared_ptr<Cancelable>& cancelable)
428 + uint result{++request_id};
435 + void cancel_and_remove_for_id(uint id)
448 + uint request_id{0};
450 + std::unordered_map<uint, std::shared_ptr<Cancelable>> store;
454 +HttpClientNetCpp::HttpClientNetCpp(uint no_reply_timeout)
529 +void HttpClientNetCpp::cancel_get(uint id)
923 HttpClientTest(uint no_reply_timeout = 20000)

It would be good to ditch the static library for smartscopes, I don't think we need it anymore.

While you are working on this anyway, would you mind making the lineData lambda thread-safe? At the moment, it appends to the string from a different thread without a lock.

Also, the lineData param should be called line_data instead.

Minor style issue here:

506 + } else
507 + {

And here (missing curlies):

465 + if (worker.joinable())
466 + worker.join();

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Michi Henning (michihenning) wrote : Posted in a previous version of this proposal

Thanks for that!

One request (please forgive me for being anal):

10 +find_library(ZMQPPLIB zmqpp)
11 +if(NOT ZMQPPLIB)
12 + message(FATAL_ERROR "Zmqpp lib not found.")
13 +endif()

I think this is nice. Without this, cmake says:

CMake Error at CMakeLists.txt:122 (message):
   Capnp compiler not found.

But it would be a *lot* nicer if it actually told me the package name instead of "Zmqpp lib not found".

I can't count the number of times where some sort of install script told me that command "foo" or library "libxyz" couldn't be found, and then I have to spend five minutes trying to figure out which package bloody "foo" or "libxyz" can be found in.

So, I'd change the error messages to actually spell out the package name "package capnproto not found". That way, I can just copy and paste: "apt-get install capnproto" and Bob's my uncle :-)

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote : Posted in a previous version of this proposal

> Thanks for that!
>
> One request (please forgive me for being anal):
>
> 10 +find_library(ZMQPPLIB zmqpp)
> 11 +if(NOT ZMQPPLIB)
> 12 + message(FATAL_ERROR "Zmqpp lib not found.")
> 13 +endif()
>
> I think this is nice. Without this, cmake says:
>
> CMake Error at CMakeLists.txt:122 (message):
> Capnp compiler not found.
>
> But it would be a *lot* nicer if it actually told me the package name instead
> of "Zmqpp lib not found".
>
> I can't count the number of times where some sort of install script told me
> that command "foo" or library "libxyz" couldn't be found, and then I have to
> spend five minutes trying to figure out which package bloody "foo" or "libxyz"
> can be found in.
>
> So, I'd change the error messages to actually spell out the package name
> "package capnproto not found". That way, I can just copy and paste: "apt-get
> install capnproto" and Bob's my uncle :-)

k, done

Revision history for this message
Michi Henning (michihenning) wrote : Posted in a previous version of this proposal

Thanks for that, and thanks for your diligence!

review: Approve
Revision history for this message
Michi Henning (michihenning) wrote : Posted in a previous version of this proposal

Not sure what was broken with Jenkins last time around. Top-approving to see what happens.

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote : Posted in a previous version of this proposal

Fixed some small stupid mistakes (191 and 192), top approving again

195. By Marcus Tomlinson

Fixed formatting in control

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: