Unverified Commit e655d4a0 authored by Kip's avatar Kip Committed by GitHub

Merge pull request #873 from Tachi107/issue-187-fix

Fix #187
parents c3b6e014 270bbefe
......@@ -17,9 +17,8 @@
#endif
using namespace Pistache;
using namespace Pistache::Http;
class XProtocolVersion : public Header::Header {
class XProtocolVersion : public Http::Header::Header {
public:
NAME("X-Protocol-Version");
......@@ -68,5 +67,5 @@ private:
};
int main() {
Header::Registry::instance().registerHeader<XProtocolVersion>();
Http::Header::Registry::instance().registerHeader<XProtocolVersion>();
}
......@@ -11,11 +11,10 @@
#include <pistache/net.h>
using namespace Pistache;
using namespace Pistache::Http;
int main(int argc, char *argv[]) {
if (argc < 2) {
std::cerr << "Usage: http_client page [count]" << std::endl;
std::cerr << "Usage: http_client page [count]\n";
return 1;
}
......@@ -60,12 +59,12 @@ int main(int argc, char *argv[]) {
barrier.wait_for(std::chrono::seconds(5));
auto end = std::chrono::system_clock::now();
std::cout << "Summary of execution" << std::endl
<< "Total number of requests sent : " << count << std::endl
std::cout << "Summary of execution\n"
<< "Total number of requests sent : " << count << '\n'
<< "Total number of responses received: "
<< completedRequests.load() << std::endl
<< completedRequests.load() << '\n'
<< "Total number of requests failed : " << failedRequests.load()
<< std::endl
<< '\n'
<< "Total time of execution : "
<< std::chrono::duration_cast<std::chrono::milliseconds>(end -
start)
......
......@@ -12,7 +12,6 @@
#include <pistache/endpoint.h>
#include <pistache/common.h>
using namespace std;
using namespace Pistache;
struct LoadMonitor {
......@@ -165,8 +164,8 @@ int main(int argc, char *argv[]) {
Address addr(Ipv4::any(), port);
cout << "Cores = " << hardware_concurrency() << endl;
cout << "Using " << thr << " threads" << endl;
std::cout << "Cores = " << hardware_concurrency() << std::endl;
std::cout << "Using " << thr << " threads" << std::endl;
auto server = std::make_shared<Http::Endpoint>(addr);
......
......@@ -8,7 +8,7 @@ public:
HTTP_PROTOTYPE(HelloHandler)
void onRequest(const Http::Request& request, Http::ResponseWriter response) override{
void onRequest(const Http::Request& request, Http::ResponseWriter response) override {
UNUSED(request);
response.send(Pistache::Http::Code::Ok, "Hello World\n");
}
......
......@@ -10,7 +10,6 @@
#include <pistache/thirdparty/serializer/rapidjson.h>
using namespace std;
using namespace Pistache;
namespace Generic {
......@@ -145,8 +144,8 @@ int main(int argc, char *argv[]) {
Address addr(Ipv4::any(), port);
cout << "Cores = " << hardware_concurrency() << endl;
cout << "Using " << thr << " threads" << endl;
std::cout << "Cores = " << hardware_concurrency() << std::endl;
std::cout << "Using " << thr << " threads" << std::endl;
BankerService banker(addr);
......
......@@ -10,7 +10,6 @@
#include <pistache/router.h>
#include <pistache/endpoint.h>
using namespace std;
using namespace Pistache;
void printCookies(const Http::Request& req) {
......@@ -158,8 +157,8 @@ int main(int argc, char *argv[]) {
Address addr(Ipv4::any(), port);
cout << "Cores = " << hardware_concurrency() << endl;
cout << "Using " << thr << " threads" << endl;
std::cout << "Cores = " << hardware_concurrency() << std::endl;
std::cout << "Using " << thr << " threads" << std::endl;
StatsEndpoint stats(addr);
......
......@@ -32,8 +32,8 @@ fetchOp
[](const User& user) { return fetchUserInfo(user); },
Async::Throw)
.then(
[](const UserInfo& info) { std::cout << "User name = " << info.name << std::endl; },
[](exception_ptr ptr) { std::cout << "An exception occured during user retrieval" << std::endl;}
[](const UserInfo& info) { std::cout << "User name = " << info.name << '\n'; },
[](exception_ptr ptr) { std::cerr << "An exception occured during user retrieval\n";}
);
```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment