Skip to content

Commit

Permalink
Merge pull request #7 from LEvertz/LEvertz-TCPbind
Browse files Browse the repository at this point in the history
fixed a concurrency problem leading to a segfault
  • Loading branch information
HolgerJeromin committed Dec 17, 2015
2 parents 38717e0 + b38ea7e commit 1efb00b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions syslibs/comm/TCPbind/source/aresWorker.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ OV_DLLFNCEXPORT getAddrInfoElem *TCPbind_aresWorker_insertGetAddrInfo(
pNewElem->status = AIESTATUS_WAITING;
/* last element is never deleted, so the pointer is always valid */
pNewElem->pPrevious = elemList.pLastElem;
if(!elemList.pLastElem){
/* elemList was deleted in shutdown --> no more transactions
* no concurrency implications as this very function is called from the same thread as shutdown */
free(pNewElem);
KS_logfile_warning(("aresWorker - insertGetAddrInfo: trying to open a new connection after shutdown. Won't do it"));
return 0;
}
/* insert Element -> this is the only atomic action */
elemList.pLastElem->pNext = pNewElem;
/* this one does not need to be atomic, as no other thread touches this value */
Expand Down

0 comments on commit 1efb00b

Please sign in to comment.