Skip to content

Commit

Permalink
remove deprecated Listen method
Browse files Browse the repository at this point in the history
Summary: remove deprecated Listen method

Reviewed By: podtserkovskiy

Differential Revision: D58809276

fbshipit-source-id: c22e4b17197805107b5798d38b7cf6ec77d96829
  • Loading branch information
Walter Schulze authored and facebook-github-bot committed Jun 20, 2024
1 parent a5db2be commit 8efc4a3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 0 additions & 2 deletions thrift/lib/go/thrift/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (

// Server is a thrift server
type Server interface {
// Deprecated: Listen is replaced by Addr method
Listen() (net.Addr, error)
// Addr returns the address the server is listening on.
Addr() net.Addr
// Serve starts the server
Expand Down
11 changes: 1 addition & 10 deletions thrift/lib/go/thrift/simple_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ func simpleServerOptions(options ...func(*ServerOptions)) *ServerOptions {
return opts
}

// Deprecated: Listen does not listen, to get Addr use Addr method.
func (p *SimpleServer) Listen() (net.Addr, error) {
return p.listener.Addr(), nil
}

// Addr returns the server listener's Addr
func (p *SimpleServer) Addr() net.Addr {
return p.listener.Addr()
Expand Down Expand Up @@ -121,15 +116,11 @@ func (p *SimpleServer) Serve() error {

// ServeContext behaves like Serve but supports cancellation via context.
func (p *SimpleServer) ServeContext(ctx context.Context) error {
_, err := p.Listen()
if err != nil {
return err
}
go func() {
<-ctx.Done()
p.Stop()
}()
err = p.acceptLoopContext(ctx)
err := p.acceptLoopContext(ctx)
if ctx.Err() != nil {
return ctx.Err()
}
Expand Down

0 comments on commit 8efc4a3

Please sign in to comment.