fishy commented on code in PR #3379:
URL: https://github.com/apache/thrift/pull/3379#discussion_r3068301766
##########
lib/go/thrift/server_socket.go:
##########
@@ -44,28 +47,61 @@ func NewTServerSocketTimeout(listenAddr string,
clientTimeout time.Duration) (*T
if err != nil {
return nil, err
}
- return &TServerSocket{addr: addr, clientTimeout: clientTimeout}, nil
+
+ return NewTServerSocketFromAddrTimeout(addr, clientTimeout), nil
}
+// NewTServerSocketFromAddrTimeout returns TServerSocket
// Creates a TServerSocket from a net.Addr
func NewTServerSocketFromAddrTimeout(addr net.Addr, clientTimeout
time.Duration) *TServerSocket {
- return &TServerSocket{addr: addr, clientTimeout: clientTimeout}
+ factory := func(addr net.Addr) (net.Listener, error) {
+ return net.Listen(addr.Network(), addr.String())
+ }
+
+ return NewTServerSocketFromFactoryTimeout(factory, addr, clientTimeout)
}
-func (p *TServerSocket) Listen() error {
+// NewTServerSocketFromFactoryTimeout returns TServerSocket
+// Allows full customization (TLS, mocks, unix sockets, windows named pipes,
etc.)
Review Comment:
Something like:
```suggestion
// NewTServerSocketFromFactoryTimeout creates TServerSocket via a listener
factory.
//
// Allows full customization (TLS, mocks, unix sockets, windows named pipes,
etc.)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]