* SimpleMessenger only lets you do start_rank once

git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1288 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
sageweil 2007-03-22 16:36:52 +00:00
parent 981f2a1b65
commit cebf62664b
2 changed files with 12 additions and 3 deletions

View File

@ -697,7 +697,8 @@ void Rank::Pipe::fail(list<Message*>& out)
*/
Rank::Rank() :
single_dispatcher(this) {
single_dispatcher(this),
started(false) {
// default to any listen_addr
memset((char*)&listen_addr, 0, sizeof(listen_addr));
listen_addr.sin_family = AF_INET;
@ -787,7 +788,14 @@ void Rank::reaper()
int Rank::start_rank()
{
lock.Lock();
if (started) {
dout(10) << "start_rank already started" << endl;
lock.Unlock();
return 0;
}
dout(10) << "start_rank" << endl;
lock.Unlock();
// bind to a socket
if (accepter.start() < 0)
@ -802,7 +810,7 @@ int Rank::start_rank()
lock.Lock();
dout(1) << "start_rank at " << listen_addr << endl;
started = true;
lock.Unlock();
return 0;
}

View File

@ -238,7 +238,8 @@ private:
public:
Mutex lock;
Cond wait_cond; // for wait()
bool started;
// where i listen
tcpaddr_t listen_addr;
entity_addr_t my_addr;