Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 597517 Details for
Bug 839223
c++ client throws exception when connections are stored in global namespace
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
reproducer -- simple connector client
connector.cc (text/plain), 3.90 KB, created by
Zdenek Kraus
on 2012-07-11 09:33:30 UTC
(
hide
)
Description:
reproducer -- simple connector client
Filename:
MIME Type:
Creator:
Zdenek Kraus
Created:
2012-07-11 09:33:30 UTC
Size:
3.90 KB
patch
obsolete
> >#include <qpid/messaging/Connection.h> >#include <qpid/messaging/Message.h> >#include <qpid/messaging/Receiver.h> >#include <qpid/messaging/Sender.h> >#include <qpid/messaging/Session.h> >#include <qpid/Exception.h> > >#include <cstdlib> >#include <iostream> > >#include <sys/types.h> >#include <unistd.h> >#include <signal.h> > > > std::list<qpid::messaging::Connection> conn_list; > >void printUsage() { > std::cout << "Usage: " << std::endl > << " python connector.py <broker> <connection-count> [--hold]" << std::endl > << " example pyton connector.py \"localhost:5672\" \"10\"" << std::endl > << " hold - connect for <connectio-count> times and wait for further actions" << std::endl > << " in HOLD mode, the connector awaits for SIGINT signal, then ends cleanly" << std::endl; > return; >} > >void hold_mode_exit(int signum) { > std::list<qpid::messaging::Connection>::iterator conn_list_it; > for (conn_list_it = conn_list.begin(); conn_list_it != conn_list.end(); conn_list_it++) { > (*conn_list_it).close(); > } > exit(0); >} > > >int main (int argc, char ** argv) { > > signal(SIGINT,hold_mode_exit); > > if (argc < 3) { > std::cerr << "Error in parameters" << std::endl; > printUsage(); > return 2; > } > >// settings defaults > std::string broker = "localhost:5672"; > int cnt = 1; > bool hold = false; > int conn_counter = 0; > bool note_displayed = false; > int sleep_interval = 30; > > >// settings from parameters > broker.assign(argv[1]); > cnt = atoi(argv[2]); > if (argc > 3) { > std::string tmp_argv_3(argv[3]); > if (tmp_argv_3.compare("--hold") == 0) { > hold = true; > } else { > std::cerr << "Warning: unknown parameter \"" << tmp_argv_3 << "\"" << std::endl; > } > } > > > >// internals init > > // std::list<qpid::messaging::Connection> conn_list; > > try { > for (int i=0; i < cnt; i++) { > qpid::messaging::Connection tmp_connection(broker); > conn_list.push_back(tmp_connection); > } > > std::list<qpid::messaging::Connection>::iterator conn_list_it; > for (conn_list_it = conn_list.begin(); conn_list_it != conn_list.end(); conn_list_it++) { > //(*conn_list_it).setOption("username", "usera"); > //(*conn_list_it).setOption("password", "password"); > (*conn_list_it).open(); > //(*conn_list_it).close(); > conn_counter++; > } > std::cout << "Opened connections: " << conn_counter << std::endl; > if (hold == true) { > while (true) { > sleep(sleep_interval); > if (note_displayed == false) { > std::cout << "note: to end connector send SIGINT to " << getpid() << std::endl; > note_displayed = true; > sleep_interval = 4096; > } > } > } > } > catch(const qpid::Exception& error) { > std::cout << "[1]" << std::endl; > std::cout << "Opened connections: " << conn_counter << std::endl; > std::cerr << error.what() << std::endl; > /*std::list<qpid::messaging::Connection>::iterator conn_list_it; > for (conn_list_it = conn_list.begin(); conn_list_it != conn_list.end(); conn_list_it++) { > (*conn_list_it).close(); > }*/ > return 1; > } > catch(const std::exception& error) { > std::cout << "[2]" << std::endl; > std::cout << "Opened connections: " << conn_counter << std::endl; > std::cerr << error.what() << std::endl; > /*std::list<qpid::messaging::Connection>::iterator conn_list_it; > for (conn_list_it = conn_list.begin(); conn_list_it != conn_list.end(); conn_list_it++) { > (*conn_list_it).close(); > }*/ > return 1; > } > > try { > std::list<qpid::messaging::Connection>::iterator conn_list_it; > for (conn_list_it = conn_list.begin(); conn_list_it != conn_list.end(); conn_list_it++) { > if ((*conn_list_it).isOpen()) { > (*conn_list_it).close(); > } > } > } > catch(const qpid::Exception& error) { > std::cout << "[3]" << std::endl; > std::cout << "Opened connections: " << conn_counter << std::endl; > std::cerr << error.what() << std::endl; > return 1; > } > > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 839223
: 597517