Skip to content
Browse files

fix credit client cleanup. update libten

  • Loading branch information...
1 parent d96e44c commit c58621e0ff653d8c97de2a67fb3e1b17933bf70c @toffaletti committed Feb 17, 2012
Showing with 9 additions and 4 deletions.
  1. +4 −3 credit-client.cc
  2. +4 −0 credit-client.hh
  3. +1 −1 libten
View
7 credit-client.cc
@@ -74,7 +74,9 @@ struct config {
// globals
static config conf;
-void f(credit_client &cc) {
+static void startup() {
+ taskname("startup");
+ credit_client cc(conf.server_host, conf.server_port);
if (cc.query(conf.db, conf.key, conf.value)) {
std::cout << conf.db << "[" << conf.key << "]=" << conf.value << "\n";
} else {
@@ -99,7 +101,6 @@ int main(int argc, char *argv[]) {
conf.server_port = 9876;
parse_host_port(conf.server_host, conf.server_port);
- credit_client cc(conf.server_host, conf.server_port);
- taskspawn(std::bind(f, std::ref(cc)));
+ taskspawn(startup, 8*1024*1024);
return p.main(argc, argv);
}
View
4 credit-client.hh
@@ -63,6 +63,10 @@ public:
_recv_tid = taskspawn(std::bind(&credit_client::recv_task, this));
}
+ ~credit_client() {
+ close();
+ }
+
bool query(const std::string &db, uint64_t key, uint64_t &val, unsigned int timeout_ms=100) {
packet pkt;
pkt.xid = xid++;
2 libten
@@ -1 +1 @@
-Subproject commit 278dbb1cb82d5bc490a4ec5551d625770be93858
+Subproject commit 742cb634418498613f3750f5fbe63a6f82b7eab3

0 comments on commit c58621e

Please sign in to comment.
Something went wrong with that request. Please try again.