Cleanup socketmodule.c

Issue #27744:

* PEP 7: add {...} around if blocks
* assign variables and then check their value in if() to make the code easier
  to read and to debug.
1 file changed