If it's a simple flood, then this might help mitigate some unnecessary processing - but this won't stop anything that's sophisticated or of a larger scale. I'm not the most experienced with preventing DDoS attacks, but I know lots of attacks don't just flood: they exhaust ports, take advantage of vulnerabilities / closing behaviors in sockets, flood a specific routine from outside the server, or target the operating system and networking infrastructure. This change does very little to stop that - but it is a necessary precaution. Flooding connections isn't great in general if it can be avoided.
Here's an example of just a coding mistake that could have potentially caused a denial of service that Relic found in my project:

. Just goes to show it can be caused by a lot of potential edge cases / flaws. Here's also another example of basic flood protection on the server:

.