You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/11/10 21:24:05 UTC

thrift git commit: THRIFT-2811 Make remote socket address accessible Client: Go Patch: Craig Peterson

Repository: thrift
Updated Branches:
  refs/heads/master 1cf9612a7 -> 4c3309405


THRIFT-2811 Make remote socket address accessible
Client: Go
Patch: Craig Peterson

This closes #255

Go Library - Make remote socket address accessible

In my server I would like to log the remote ip address of incoming connections. This patch makes the addr available on TSocket via an accessor, so my server implementation can read it and log it or do other things with it.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/4c330940
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/4c330940
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/4c330940

Branch: refs/heads/master
Commit: 4c33094050e48222b0b9ecb837644d8ef1619c1c
Parents: 1cf9612
Author: Jens Geyer <je...@apache.org>
Authored: Mon Nov 10 21:22:34 2014 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Mon Nov 10 21:22:34 2014 +0100

----------------------------------------------------------------------
 lib/go/thrift/socket.go | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/4c330940/lib/go/thrift/socket.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/socket.go b/lib/go/thrift/socket.go
index a381ea2..d5af4f4 100644
--- a/lib/go/thrift/socket.go
+++ b/lib/go/thrift/socket.go
@@ -126,6 +126,11 @@ func (p *TSocket) Close() error {
 	return nil
 }
 
+//Returns the remote address of the socket.
+func (p *TSocket) Addr() net.Addr {
+	return p.addr
+}
+
 func (p *TSocket) Read(buf []byte) (int, error) {
 	if !p.IsOpen() {
 		return 0, NewTTransportException(NOT_OPEN, "Connection not open")