Github user necouchman commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/184#discussion_r133608587
  
    --- Diff: 
guacamole/src/main/java/org/apache/guacamole/tunnel/TunnelRequestService.java 
---
    @@ -58,6 +64,74 @@
         private AuthenticationService authenticationService;
     
         /**
    +     * A service for notifying listeners about tunnel connect/closed 
events.
    +     */
    +    @Inject
    +    private ListenerService listenerService;
    +
    +    /**
    +     * Notifies bound TunnelConnectListeners that a new tunnel has been 
connected.
    +     * Listeners are allowed to veto a connected tunnel by returning false 
from the
    +     * listener method. If the ListenerService indicates that any listener 
rejected
    +     * the tunnel, the tunnel is closed an 
GuacamoleTunnelRejectedException is thrown.
    +     *
    +     * @param userContext
    +     *      The UserContext associated with the user for whom the tunnel is
    +     *      being created.
    +     *
    +     * @param credentials
    +     *      Credentials that authenticate the user
    +     *
    +     * @param tunnel
    +     *      The tunnel that was connected
    +     *
    +     * @throws GuacamoleException
    +     *     If thrown by a listener or if any listener vetoes the connected 
tunnel
    +     */
    +    private void notifyTunnelConnectListeners(UserContext userContext,
    +            Credentials credentials, GuacamoleTunnel tunnel) throws 
GuacamoleException {
    +        TunnelConnectEvent event = new TunnelConnectEvent(userContext, 
credentials, tunnel);
    +        boolean ok = listenerService.tunnelConnected(event);
    +        if (!ok) {
    --- End diff --
    
    Why not just:
    `if (!listenerService.tunnelConnected(event)) {`
    ??
    
    In fact, you did this in the next method down...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to