Skip to content

Commit

Permalink
Cliente del Shared Server (Curl).
Browse files Browse the repository at this point in the history
  • Loading branch information
elianadiaz committed Apr 28, 2016
1 parent 899f8f9 commit 777f5c7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions TinderTaller/include/ClientService.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
#include "ClientUtils.h"

class ClientService {
public:
ClientService();
virtual ~ClientService();
MemoryStruct getClientService(const char * url);
MemoryStruct postClientService(const char * url, const char * data);
MemoryStruct putClientService(const char * url, const char * data);
MemoryStruct deleteClientService(const char * url);
public:
ClientService();
virtual ~ClientService();
MemoryStruct getClientService(const char * url);
MemoryStruct postClientService(const char * url, const char * data);
MemoryStruct putClientService(const char * url, const char * data);
MemoryStruct deleteClientService(const char * url);
};

#endif /* SRC_CLIENTSERVICE_H_ */
1 change: 0 additions & 1 deletion TinderTaller/include/ClientUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ struct MemoryStruct {
size_t size;
};


static size_t writeMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp){
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)userp;
Expand Down
1 change: 0 additions & 1 deletion TinderTaller/include/SharedClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class SharedClient {
msg_t * deleteUser(string userId);
msg_t * getInterests();
msg_t * setInterests(string & interests);

private:
ClientService * clientService;
};
Expand Down
2 changes: 1 addition & 1 deletion TinderTaller/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ add_library(libtindertaller SHARED ${SOURCES} ${DirUtils} ${DirHandlers})
TARGET_LINK_LIBRARIES(tindertaller -ftest-coverage)
TARGET_LINK_LIBRARIES(tindertaller rocksdb )
TARGET_LINK_LIBRARIES(tindertaller jsoncpp )
TARGET_LINK_LIBRARIES(tindertaller curl )
TARGET_LINK_LIBRARIES(tindertaller curl )



1 change: 1 addition & 0 deletions TinderTaller/src/ClientService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,4 @@ MemoryStruct ClientService::deleteClientService(const char * url){
chunk.status = res;
return chunk;
}

6 changes: 3 additions & 3 deletions TinderTaller/src/Handlers/HandlerUsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ msg_t HandlerUsers::postUser(struct http_message * hm) {
val["token"]=token;
string * result = new string();
result->append(jsonParse.valueToString(val));
msg.change(CREATED, result);

//Va a dar de alta el usuario en el Shared
SharedClient * sharedClient = new SharedClient();
string user = "";
user.append(hm->body.p);
msg_t * response = sharedClient->setUser(user);
msg.status = response->status;
msg.body = response->body;
delete response->body;
delete response;
delete sharedClient;

msg.change(CREATED, result);
} else {
LOG(WARNING)<<"Not success";
string * result = new string();
Expand Down
1 change: 1 addition & 0 deletions TinderTaller/src/SharedClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SharedClient::SharedClient() {
this->clientService = new ClientService();
}


SharedClient::~SharedClient() {
LOG(INFO)<< "Borro Shared Cliente";
delete this->clientService;
Expand Down
2 changes: 1 addition & 1 deletion TinderTaller/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ add_executable(Test ${_SOURCES_CPP_TESTS})
TARGET_LINK_LIBRARIES(Test gtest_main)
TARGET_LINK_LIBRARIES(Test pthread)
TARGET_LINK_LIBRARIES(Test rocksdb )
TARGET_LINK_LIBRARIES(Test curl )
TARGET_LINK_LIBRARIES(Test curl )

0 comments on commit 777f5c7

Please sign in to comment.