Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release thread attr handles and block default route on compression #105

Merged
merged 1 commit into from
Apr 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/rdkafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,21 +1039,25 @@ rd_kafka_t *rd_kafka_new (rd_kafka_type_t type, rd_kafka_conf_t *conf,
"Failed to create thread: %s", strerror(err));
rd_kafka_destroy0(rk); /* handler thread */
rd_kafka_destroy0(rk); /* application refcnt */
/* Restore sigmask of caller */
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
/* Restore sigmask of caller */
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
/* Release thread attribute storage */
pthread_attr_destroy(&attr);
errno = err;
return NULL;
}


/* Add initial list of brokers from configuration */
if (rk->rk_conf.brokerlist)
rd_kafka_brokers_add(rk, rk->rk_conf.brokerlist);

(void)rd_atomic_add(&rd_kafka_handle_cnt_curr, 1);

/* Restore sigmask of caller */
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
/* Restore sigmask of caller */
pthread_sigmask(SIG_SETMASK, &oldset, NULL);

/* Release thread attribute storage */
pthread_attr_destroy(&attr);

return rk;
}
Expand Down
21 changes: 17 additions & 4 deletions src/rdkafka_broker.c
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,11 @@ static int rd_kafka_broker_produce_toppar (rd_kafka_broker_t *rkb,

/* Free snappy environment */
snappy_free_env(&senv);
break;

default:
rd_kafka_assert(rkb->rkb_rk, !*"notreached: compression.codec");
break;

}

Expand Down Expand Up @@ -4000,8 +4005,13 @@ static rd_kafka_broker_t *rd_kafka_broker_add (rd_kafka_t *rk,

free(rkb);
rd_kafka_destroy(rk);
/* Restore sigmask of caller */
pthread_sigmask(SIG_SETMASK, &oldset, NULL);

/* Restore sigmask of caller */
pthread_sigmask(SIG_SETMASK, &oldset, NULL);

/* Release thread attribute storage */
pthread_attr_destroy(&attr);

return NULL;
}

Expand All @@ -4012,8 +4022,11 @@ static rd_kafka_broker_t *rd_kafka_broker_add (rd_kafka_t *rk,
"Added new broker with NodeId %"PRId32,
rkb->rkb_nodeid);

/* Restore sigmask of caller */
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
/* Restore sigmask of caller */
pthread_sigmask(SIG_SETMASK, &oldset, NULL);

/* Release thread attribute storage */
pthread_attr_destroy(&attr);

return rkb;
}
Expand Down