Remove unreachable code reported by go vet

This commit is contained in:
Ola Bini 2019-12-21 16:06:26 +00:00
parent bbb589fb37
commit d9b6cbb89f
No known key found for this signature in database
GPG key ID: 6786A150F6A2B28F
4 changed files with 40 additions and 46 deletions

View file

@ -392,10 +392,9 @@ func (client *Client) SendUDP(buf []byte) error {
crypted := make([]byte, len(buf)+client.crypt.Overhead())
client.crypt.Encrypt(crypted, buf)
return client.server.SendUDP(crypted, client.udpaddr)
} else {
return client.sendMessage(buf)
}
panic("unreachable")
return client.sendMessage(buf)
}
// Send a Message to the client. The Message in msg to the client's

View file

@ -869,13 +869,12 @@ func (server *Server) sendClientPermissions(client *Client, channel *Channel) {
}
// fixme(mkrautz): re-add when we have ACL caching
return
perm := acl.Permission(acl.NonePermission)
client.sendMessage(&mumbleproto.PermissionQuery{
ChannelId: proto.Uint32(uint32(channel.Id)),
Permissions: proto.Uint32(uint32(perm)),
})
// perm := acl.Permission(acl.NonePermission)
// client.sendMessage(&mumbleproto.PermissionQuery{
// ChannelId: proto.Uint32(uint32(channel.Id)),
// Permissions: proto.Uint32(uint32(perm)),
// })
}
type ClientPredicate func(client *Client) bool

View file

@ -161,9 +161,7 @@ func HasPermission(ctx *Context, user User, perm Permission) bool {
// permissions exccept SpeakPermission and WhisperPermission.
if perm != SpeakPermission && perm != WhisperPermission {
return (granted & (perm | WritePermission)) != NonePermission
} else {
return (granted & perm) != NonePermission
}
return false
return (granted & perm) != NonePermission
}

View file

@ -298,7 +298,8 @@ func GroupMemberCheck(current *Context, acl *Context, name string, user User) (o
pdepth := len(userChain) - 1
return pdepth >= mindepth && pdepth <= maxdepth
} else {
}
// Non-magic groups
groups := []Group{}
@ -333,9 +334,6 @@ func GroupMemberCheck(current *Context, acl *Context, name string, user User) (o
return isMember
}
return false
}
// GroupNames gets the list of group names for the given ACL context.
//
// This function walks the through the context chain to figure