Revision 8b0f290d

b/vncauthproxy/client.py
131 131
        "auth_password": auth_password,
132 132
    }
133 133

  
134
    last_error = None
134 135
    retries = 5
135 136
    while retries:
136 137
        # Initiate server connection
......
160 161

  
161 162
            try:
162 163
                server.connect(sa)
163
            except socket.error:
164
            except socket.error as err:
164 165
                server.close()
165 166
                server = None
166 167
                retries -= 1
168
                last_error = err
167 169
                continue
168 170

  
169 171
            retries = 0
......
172 174
        sleep(0.2)
173 175

  
174 176
    if server is None:
175
        raise Exception("Failed to connect to server")
177
        raise Exception("Failed to connect to server: %s" % last_error)
176 178

  
177 179
    server.send(json.dumps(req))
178 180

  

Also available in: Unified diff