gateway accept's remote address improvements
gateway accept's remote address improvements

taken from sia@ff2adc87343501cac6c79db6340e53b1817aa4fe
and sia@b7a2a5704979bcebe19250f62c1eee20cc2af1ca

rivine/rivine,rivine/rivine