Printing a socket address is too complex
@pborelli
Submitted by Paolo Borelli Link to original bug (#736441)
Description
logging a simple message like "Connected to 123.123.123.123:42" requires a lot of boring code:
- from the connection you get the GSocketAddress
- you cast GSocketAddress to GInetSocketAddress making an ugly assumption
- from the GInetSocketAddress you get the GInetAddress
- GInetAddress finally has a to_string() method that just gives you the IP part
- the you get the port from the the GInetSocketAddress
- then you strdup_printf the two
GSocketAddress should have a print method that
- takes care of all this stuff for me
- does not require to assume that it can be casted to a specific subclass
I guess (2) requires adding a vfunc implemented by the subclasses