Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ func main() {
// a very simple way to track authenticated connections
authenticatedConnections := map[int]struct{}{}

// a gldap.OnClose function to clean up connections from the
// authenticatedConnections map when they are closed
onCloseFn := func(connId int) {
delete(authenticatedConnections, connId)
log.Printf("connection %d closed", connId)
}
// create a new server
s, err := gldap.NewServer(gldap.WithLogger(l), gldap.WithDisablePanicRecovery())
s, err := gldap.NewServer(gldap.WithLogger(l), gldap.WithDisablePanicRecovery(), gldap.WithOnClose(onCloseFn))
if err != nil {
log.Fatalf("unable to create server: %s", err.Error())
}
Expand Down
Loading