In january, osmo_sock_get_name() was introduced and prints the connection info for a given fd, which looks like this:
127.0.0.1:2905<->127.0.0.1:60661
However, when I first saw this in a log, I was confused: I expect the local address and port to be on the left, while in this string it is on the right.
Is it only me and I should get used to it, or can we reverse that so the local part is on the left? I could argue that in most GSM graphics and ladder diagrams, the client side is on the left, and that we would typically use this string on the client side to indicate where we connected to. Is this even true? Should there be an arg to pick the preferred order? :P
I'll submit a patch if anyone agrees.
~N
I think both variants are bad - instead of guessing which order is saner we should just explicitly mark what is what. Smth like
R:127.0.0.1:2905<->L:127.0.0.1:60661
21.06.2017 00:33, Neels Hofmeyr пишет:
Is it only me and I should get used to it, or can we reverse that so the local part is on the left?
In terms of left/right: I think there is no obvious or correct way.
My original idea was that a system administrator would inherently know which of the two sides is the local side of the socket, based on his configuration.
Based on the fd it's unfortunately not possible to have an explicit "CLIENT -> SERVER" kind of notation replacing the bi-directional arrow that we currently print. This would require that we keep a lot more state and nothing that can be derived from the fd alone :/
On Wed, Jun 21, 2017 at 05:17:18AM +0200, Neels Hofmeyr wrote:
On Wed, Jun 21, 2017 at 12:58:59AM +0200, Max wrote:
R:127.0.0.1:2905<->L:127.0.0.1:60661
+1, I'd even favor writing out 'remote:' and 'local:'.
L/R I can still live with, but please don't make it even longer.
On Wed, Jun 21, 2017 at 09:54:40PM +0300, Harald Welte wrote:
In terms of left/right: I think there is no obvious or correct way.
Based on the fd it's unfortunately not possible to have an explicit "CLIENT -> SERVER" kind of notation replacing the bi-directional arrow that we currently print. This would require that we keep a lot more state and nothing that can be derived from the fd alone :/
On Wed, Jun 21, 2017 at 05:17:18AM +0200, Neels Hofmeyr wrote:
On Wed, Jun 21, 2017 at 12:58:59AM +0200, Max wrote:
+1, I'd even favor writing out 'remote:' and 'local:'.
My original idea was that a system administrator would inherently know which of the two sides is the local side of the socket, based on his configuration.
In this output: 127.0.0.1:2905<->127.0.0.1:60661 it is always unclear who is using 2905 and who 60661.
L/R I can still live with, but please don't make it even longer.
But then it looks like "Left" and "Right", with Left on the right and Right on the left ... I'd still prefer explicit strings, they're not taking up much space.
If you guys outvote me on "L" "R", it's still better than nothing...
I just posted both variants:
https://gerrit.osmocom.org/3000 https://gerrit.osmocom.org/3001
Let your votes decide which one wins.
(I picked '=' instead of ':' because ':' is already used as the port number separator.)
~N