cout << "cfuse[" << getpid() << "]: starting ceph client" << std::endl;
- messenger->start_with_nonce(false, getpid()); // Do not daemonize here
+ messenger->start_with_nonce(getpid());
// start client
client->init();
messenger->set_policy(entity_name_t::TYPE_CLIENT,
SimpleMessenger::Policy::stateful_server(supported, 0));
- messenger->start((shadow == MDSMap::STATE_ONESHOT_REPLAY ? false : g_conf.daemonize));
+ if (shadow == MDSMap::STATE_ONESHOT_REPLAY ? false : g_conf.daemonize)
+ common_init_daemonize(&g_conf);
+ messenger->start();
// start mds
MDS *mds = new MDS(g_conf.name.get_id().c_str(), messenger, &mc);
messenger->set_default_send_priority(CEPH_MSG_PRIO_HIGH);
Monitor *mon = new Monitor(g_conf.name.get_id(), &store, messenger, &monmap);
- messenger->start(g_conf.daemonize);
+ if (g_conf.daemonize)
+ common_init_daemonize(&g_conf);
+ messenger->start();
uint64_t supported =
CEPH_FEATURE_UID |
#include "common/signal.h"
#include "common/version.h"
#include "include/color.h"
+#include "common/Thread.h"
+#include "common/pidfile.h"
#include <errno.h>
#include <deque>
return 1;
}
- client_messenger->start(g_conf.daemonize);
- messenger_hb->start(false); // do not daemonize (only need to daemonize once)
- cluster_messenger->start(false); // do not daemonize (only need to daemonize once)
+ if (g_conf.daemonize)
+ common_init_daemonize(&g_conf);
+ client_messenger->start();
+ messenger_hb->start();
+ cluster_messenger->start();
// start osd
err = osd->init();
SyntheticClient *syn = new SyntheticClient(client);
clients.push_back(client);
synclients.push_back(syn);
- messengers[i]->start(false); // do not daemonize
+ messengers[i]->start();
}
for (list<SyntheticClient*>::iterator p = synclients.begin();
// start up network
SimpleMessenger *messenger = new SimpleMessenger();
messenger->bind(getpid());
- messenger->start(false); // do not daemonize
+ messenger->start();
messenger->register_entity(entity_name_t::CLIENT());
messenger->add_dispatcher_head(&dispatcher);
return -1002;
}
- if (messenger->start_with_nonce(false, msgr_nonce) != 0) {
+ if (messenger->start_with_nonce(msgr_nonce) != 0) {
shutdown();
return -1003;
}
rados_instance.inc();
nonce = getpid() + (1000000 * (uint64_t)rados_instance.read());
- messenger->start_with_nonce(false, nonce); // do not daemonize
+ messenger->start_with_nonce(nonce);
messenger->add_dispatcher_head(this);
dout(1) << "setting wanted keys" << dendl;
messenger->register_entity(entity_name_t::CLIENT());
messenger->add_dispatcher_head(this);
- messenger->start_with_nonce(false, getpid()); // do not daemonize
+ messenger->start_with_nonce(getpid());
monc->set_want_keys(CEPH_ENTITY_TYPE_MON|CEPH_ENTITY_TYPE_OSD|CEPH_ENTITY_TYPE_MDS);
monc->set_messenger(messenger);
messenger->register_entity(entity_name_t::CLIENT());
messenger->add_dispatcher_head(this);
- messenger->start_with_nonce(false, getpid());
+ messenger->start_with_nonce(getpid());
monc->set_want_keys(CEPH_ENTITY_TYPE_MON|CEPH_ENTITY_TYPE_OSD|CEPH_ENTITY_TYPE_MDS);
monc->set_messenger(messenger);
messenger = smessenger = new SimpleMessenger();
smessenger->register_entity(entity_name_t::CLIENT(-1));
messenger->add_dispatcher_head(this);
- smessenger->start_with_nonce(false, getpid()); // do not daemonize!
+ smessenger->start_with_nonce(getpid());
temp_msgr = true;
}
return accepter.rebind(avoid_port);
}
-int SimpleMessenger::start_with_nonce(bool daemonize, uint64_t nonce)
+int SimpleMessenger::start_with_nonce(uint64_t nonce)
{
lock.Lock();
dout(1) << "messenger.start" << dendl;
lock.Unlock();
- if (daemonize) {
- common_init_daemonize(&g_conf);
- }
-
- // go!
if (did_bind)
accepter.start();
int bind(uint64_t nonce) {
return bind(g_conf.public_addr, nonce);
}
- int start_with_nonce(bool daemonize, uint64_t nonce); // if we didn't bind
- int start(bool daemonize) { // if we did
+ int start_with_nonce(uint64_t nonce); // if we didn't bind
+ int start() { // if we did
assert(did_bind);
- return start_with_nonce(daemonize, 0);
+ return start_with_nonce(0);
}
void wait();
messenger->set_default_send_priority(CEPH_MSG_PRIO_HIGH);
messenger->add_dispatcher_head(&dispatcher);
- rank->start(false); // do not daemonize
+ rank->start();
int isend = 0;
if (whoami == 0)
// start up network
messenger = new SimpleMessenger();
messenger->register_entity(entity_name_t::CLIENT());
- messenger->start_with_nonce(false, getpid()); // do not daemonize
+ messenger->start_with_nonce(getpid());
messenger->add_dispatcher_head(&dispatcher);
g.lock.Lock();