wangyu- / udp2raw

A Tunnel which Turns UDP Traffic into Encrypted UDP/FakeTCP/ICMP Traffic by using Raw Socket,helps you Bypass UDP FireWalls(or Unstable UDP Environment)
MIT License
7.3k stars 1.17k forks source link

Completion of error handling #191

Open elfring opened 6 years ago

elfring commented 6 years ago

Would you like to add more error handling for return values from functions like the following?

wangyu- commented 6 years ago

If they indeed cause problems, I will fix them.

elfring commented 6 years ago

I suggest to avoid ignorance of return values a bit more. Would you like to detect every error situation as early as possible?

wangyu- commented 6 years ago

I will add an assert for dup2. For printf it looks overkill.

For functions which fails frequently(such as socket related) I did add a lot of error handling codes.

elfring commented 6 years ago

I would generally prefer a safe condition check there instead of a macro call with code which can be supressed.


wangyu- commented 6 years ago

I would generally prefer a safe condition check there instead of a macro call with code which can be supressed.

Though I currently dont suppress assert(since they didnt show noticeable performance difference), maybe its a good idea to define a custom assert for the codes which should never be suppressed.

Are you interested to apply aspect-oriented software development? Would you like to encapsulate error detection and corresponding exception handling as a reusable aspect in your software?

Looks interesting but a bit pedantic😂

elfring commented 6 years ago

:crystal_ball: