transport: set proper reference counts on peer_trans for local connections

Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 562 (crash resulting from bad refs in transport_setpeer)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=562
This commit is contained in:
Anand Avati 2010-01-22 08:53:49 +00:00 committed by Anand V. Avati
parent a116e5b3ef
commit 375f08e1b5

View File

@ -421,7 +421,7 @@ transport_peerproc (void *trans_data)
int
transport_setpeer (transport_t *trans, transport_t *peer_trans)
{
trans->peer_trans = peer_trans;
trans->peer_trans = transport_ref (peer_trans);
INIT_LIST_HEAD (&trans->handover.msgs);
pthread_cond_init (&trans->handover.cond, NULL);
@ -429,7 +429,7 @@ transport_setpeer (transport_t *trans, transport_t *peer_trans)
pthread_create (&trans->handover.thread, NULL,
transport_peerproc, trans);
peer_trans->peer_trans = trans;
peer_trans->peer_trans = transport_ref (trans);
INIT_LIST_HEAD (&peer_trans->handover.msgs);
pthread_cond_init (&peer_trans->handover.cond, NULL);