Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4 from RemcoTukker/master

Makefile for ubuntu and user/passcode in connect frame
  • Loading branch information...
commit cedaca3ea2f4676ec8f00dfbbd8eda088dbee47a 2 parents 963e9f6 + d00e0cd
@ekarak authored
View
5 .gitignore
@@ -0,0 +1,5 @@
+*~
+*.so.*
+*.o
+*.a
+/src/main
View
2  Make-globals
@@ -25,7 +25,7 @@ CFLAGS := -c $($(TARGET)_CFLAGS) -fPIC
DEBUG_LDFLAGS := -g
RELEASE_LDFLAGS :=
-LDFLAGS := $($(TARGET)_LDFLAGS) -lboost_system -lboost_thread
+LDFLAGS := $($(TARGET)_LDFLAGS) -lboost_system -lboost_thread -lpthread
INCLUDES := -I .
DESTDIR := /usr/local
View
18 src/BoostStomp.cpp
@@ -114,7 +114,7 @@ namespace STOMP {
// Called by the user of the client class to initiate the connection process.
// The endpoint iterator will have been obtained using a tcp::resolver.
- void BoostStomp::start()
+ void BoostStomp::start(string& login, string& passcode)
{
debug_print("starting...");
m_stopped = false;
@@ -125,7 +125,13 @@ namespace STOMP {
boost::asio::ip::resolver_query_base::numeric_service)
);
// Start the connect actor.
- start_connect(endpoint_iter);
+ start_connect(endpoint_iter, login, passcode);
+ }
+
+ void BoostStomp::start()
+ {
+ std::string empty = "";
+ start(empty, empty);
}
// This function terminates all the actors to shut down the connection. It
@@ -157,7 +163,7 @@ namespace STOMP {
// --------------------------------------------------
// --------------------------------------------------
- void BoostStomp::start_connect(tcp::resolver::iterator endpoint_iter)
+ void BoostStomp::start_connect(tcp::resolver::iterator endpoint_iter, string& login, string& passcode)
// --------------------------------------------------
{
if (endpoint_iter != tcp::resolver::iterator())
@@ -175,6 +181,10 @@ namespace STOMP {
hdrmap headers;
headers["accept-version"] = "1.1";
headers["host"] = m_hostname;
+ if (!login.empty()) {
+ headers["login"] = login;
+ headers["passcode"] = passcode;
+ }
Frame frame( "CONNECT", headers );
frame.encode(stomp_request);
debug_print("Sending CONNECT frame...");
@@ -188,7 +198,7 @@ namespace STOMP {
// before starting a new one.
m_socket->close();
// Try the next available endpoint.
- start_connect(++endpoint_iter);
+ start_connect(++endpoint_iter, login, passcode);
}
}
else
View
3  src/BoostStomp.hpp
@@ -114,7 +114,7 @@ namespace STOMP {
void process_RECEIPT();
void process_ERROR();
- void start_connect(tcp::resolver::iterator endpoint_iter);
+ void start_connect(tcp::resolver::iterator endpoint_iter, string& login, string& passcode);
void handle_connect(const boost::system::error_code& ec, tcp::resolver::iterator endpoint_iter);
//TODO: void setup_stomp_heartbeat(int cx, int cy);
@@ -147,6 +147,7 @@ namespace STOMP {
stomp_server_command_map_t cmd_map;
void start();
+ void start(string& login, string& passcode);
void stop();
// Set or clear the debug flag
Please sign in to comment.
Something went wrong with that request. Please try again.