mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 01:46:11 -05:00
added NULL gard in dhtPublish()
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1116 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1542d5ad2c
commit
9d89c12a38
@ -51,14 +51,19 @@ class dhtPublishData
|
||||
|
||||
extern "C" void* doDhtPublish(void* p)
|
||||
{
|
||||
#ifdef OPENDHT_DEBUG
|
||||
std::cerr << "in doDhtPublish(void* p)" << std::endl ;
|
||||
#endif
|
||||
dhtPublishData *data = (dhtPublishData *) p;
|
||||
if ((!data) || (!data->mgr) || (!data->client))
|
||||
if(data == NULL)
|
||||
{
|
||||
pthread_exit(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* publish it! */
|
||||
data->client->publishKey(data->key, data->value, data->ttl);
|
||||
if(data->mgr != NULL && data->client != NULL)
|
||||
data->client->publishKey(data->key, data->value, data->ttl);
|
||||
|
||||
delete data;
|
||||
pthread_exit(NULL);
|
||||
@ -170,6 +175,10 @@ bool OpenDHTMgr::publishDHT(std::string key, std::string value, uint32_t ttl)
|
||||
/* launch a publishThread */
|
||||
pthread_t tid;
|
||||
|
||||
#ifdef OPENDHT_DEBUG
|
||||
std::cerr << "in publishDHT(.......)" << std::endl ;
|
||||
#endif
|
||||
|
||||
dhtPublishData *pub = new dhtPublishData;
|
||||
pub->mgr = this;
|
||||
pub->client = mClient;
|
||||
|
Loading…
Reference in New Issue
Block a user