Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from glaubinix/master
Browse files Browse the repository at this point in the history
Issue #4
  • Loading branch information
Andreas Andersen committed Feb 14, 2012
2 parents e06d054 + 1c0aace commit aa9df6f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
19 changes: 13 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ PROJECT(beanstalkpp)

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
FIND_PACKAGE( Boost COMPONENTS system filesystem regex iostreams REQUIRED )
link_directories(${Boost_LIBRARY_DIR})

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )

ADD_LIBRARY(
beanstalkpp SHARED tokenizedstream.cpp serverexception.cpp exception.cpp client.cpp job.cpp
Expand All @@ -13,29 +17,32 @@ ADD_LIBRARY(
ADD_EXECUTABLE(
test test.cpp
)
TARGET_LINK_LIBRARIES(test boost_iostreams boost_system beanstalkpp boost_regex pthread)
TARGET_LINK_LIBRARIES(test ${Boost_LIBRARIES} beanstalkpp pthread)

ADD_EXECUTABLE(
beansreserve beansreserve.cpp
)
TARGET_LINK_LIBRARIES(beansreserve boost_iostreams boost_system beanstalkpp boost_regex pthread)
TARGET_LINK_LIBRARIES(beansreserve ${Boost_LIBRARIES} beanstalkpp pthread)

ADD_EXECUTABLE(
beansput beansput.cpp
)
TARGET_LINK_LIBRARIES(beansput boost_iostreams boost_system beanstalkpp boost_regex pthread)
TARGET_LINK_LIBRARIES(beansput ${Boost_LIBRARIES} beanstalkpp pthread)

ADD_EXECUTABLE(
listtubes listtubes.cpp
)
TARGET_LINK_LIBRARIES(listtubes boost_iostreams boost_system beanstalkpp boost_regex pthread)
TARGET_LINK_LIBRARIES(listtubes ${Boost_LIBRARIES} beanstalkpp pthread)

ADD_EXECUTABLE(
beanspeek beanspeek.cpp
)
TARGET_LINK_LIBRARIES(beanspeek boost_iostreams boost_system beanstalkpp boost_regex pthread)
TARGET_LINK_LIBRARIES(beanspeek ${Boost_LIBRARIES} beanstalkpp pthread)

INSTALL(TARGETS beanstalkpp DESTINATION lib)
if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif(APPLE)
INSTALL(DIRECTORY . DESTINATION include/beanstalk++ FILES_MATCHING PATTERN "*.h" PATTERN "beanstalkpp.h" EXCLUDE PATTERN "*~" EXCLUDE PATTERN "*.git*" EXCLUDE PATTERN "*build*" EXCLUDE)
INSTALL(FILES "beanstalkpp.h" DESTINATION include)

Expand Down
6 changes: 4 additions & 2 deletions client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ bool Beanstalkpp::Client::peekReady(Beanstalkpp::job_p_t& jobPtr) {
job_id_t jobId;
size_t payloadSize;
char *payload;
std::stringstream s("peek-ready\r\n");

this->sendCommand(std::stringstream("peek-ready\r\n"));
this->sendCommand(s);

std::string response = this->tokenStream.nextString();
if(response.compare("NOT_FOUND") == 0) {
Expand Down Expand Up @@ -197,8 +198,9 @@ size_t Beanstalkpp::Client::watch(const std::string& tube) {

vector< string > Beanstalkpp::Client::listTubes() {
vector<string> ret;
stringstream s("list-tubes\r\n");

this->sendCommand(stringstream("list-tubes\r\n"));
this->sendCommand(s);

this->tokenStream.expectString("OK");
size_t payloadSize = this->tokenStream.expectInt();
Expand Down
5 changes: 3 additions & 2 deletions client.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ class Client {
job_id_t jobId;
size_t payloadSize;
char *payload;

this->sendCommand(std::stringstream("reserve\r\n"));
std::stringstream s("reserve\r\n");

this->sendCommand(s);

this->tokenStream.expectString("RESERVED");
jobId = this->tokenStream.expectInt();
Expand Down

0 comments on commit aa9df6f

Please sign in to comment.