RestComm / jain-sip

Disclaimer: This repository is a git-svn mirror of the project found at http://java.net/projects/jsip whose original repository is developed collaboratively by the Advanced Networking Technologies Division at the National Institute of Standards and Technology (NIST) - an agency of the United States Department of Commerce and by a community of individual and enterprise contributors. TeleStax, Inc. will perform some productization work, new features experimentation branches, etc for its TelScale jSIP product that doesn't concern the community from the main repository hence this git repository.
http://www.restcomm.com/
144 stars 152 forks source link

fixed createListeningPoint in case of IOException #175

Open fre42 opened 6 years ago

fre42 commented 6 years ago

We have a scenario where binding an IP address fails with IOException in createListeningPoint. The reason for that is that the network device with the given IP address is not there for some reason. Our application has a mechanismn to retry binding after some time repeatedly because the missing network device will be added after some time and the next try to bind may be successful. This will not work with the current implementation. I've found out that the next try to call createListeningPoint() will not fail anymore although the network device is still not there and the IP address is therefore still not bindable. Even in the case where the IP address is bindable on the second try, a bind will not take place and we will end up in a listening point that does not work. This happens because the implementation of createListeningPoint() stores the key for the listening point to a map called listeningPoints before the bind takes place (in messageProcessor.start()). An IOExecption will be thrown but the map entry will not be removed. The next time createListeningPoint is called, it will find this map entry to returns it without starting the message processor.

My suggested fix is to store the listening point key to the map after having successfully called the messageProcessor.start() method to avoid having an orphaned entry in the listening points map.

fre42 commented 6 years ago

I know that signing the CLA is still missing. I'm still waiting for my company to give me the allowance. This will hopefully happen soon.

gsaslis commented 6 years ago

@fre42 no problem - plz ping back when signed ; )