Mercurial > 510Connectbot
comparison src/ch/ethz/ssh2/transport/TransportManager.java @ 323:90537ba71897 ganymed
add ecdsa key support everywhere
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 31 Jul 2014 09:26:19 -0700 |
parents | a713e91c59c8 |
children | a1a2e33b3565 |
comparison
equal
deleted
inserted
replaced
322:a713e91c59c8 | 323:90537ba71897 |
---|---|
197 } | 197 } |
198 connectionSemaphore.notifyAll(); | 198 connectionSemaphore.notifyAll(); |
199 } | 199 } |
200 | 200 |
201 // check if we need to inform the monitors | 201 // check if we need to inform the monitors |
202 List monitors = null; | 202 List<ConnectionMonitor> monitors = null; |
203 | 203 |
204 synchronized (this) { | 204 synchronized (this) { |
205 // Short term lock to protect "connectionMonitors" | 205 // Short term lock to protect "connectionMonitors" |
206 // and "monitorsWereInformed" | 206 // and "monitorsWereInformed" |
207 // (they may be modified concurrently) | 207 // (they may be modified concurrently) |
208 if (monitorsWereInformed == false) { | 208 if (monitorsWereInformed == false) { |
209 monitorsWereInformed = true; | 209 monitorsWereInformed = true; |
210 monitors = (List) connectionMonitors.clone(); | 210 monitors = new ArrayList<ConnectionMonitor>(connectionMonitors); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 if (monitors != null) { | 214 if (monitors != null) { |
215 for (ConnectionMonitor cmon : monitors) { | 215 for (ConnectionMonitor cmon : monitors) { |
278 } | 278 } |
279 | 279 |
280 public void sendKexMessage(byte[] msg) throws IOException { | 280 public void sendKexMessage(byte[] msg) throws IOException { |
281 synchronized (connectionSemaphore) { | 281 synchronized (connectionSemaphore) { |
282 if (connectionClosed) { | 282 if (connectionClosed) { |
283 throw reasonClosedCause; | 283 throw new IOException("Sorry, this connection is closed.").initCause(reasonClosedCause); |
284 } | 284 } |
285 | 285 |
286 flagKexOngoing = true; | 286 flagKexOngoing = true; |
287 | 287 |
288 try { | 288 try { |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 public void setConnectionMonitors(List<ConnectionMonitor> monitors) { | 367 public void setConnectionMonitors(List<ConnectionMonitor> monitors) { |
368 synchronized (this) { | 368 synchronized (this) { |
369 connectionMonitors = new ArrayList<ConnectionMonitor>(); | 369 connectionMonitors = new ArrayList<ConnectionMonitor>(monitors); |
370 connectionMonitors.addAll(monitors); | |
371 } | 370 } |
372 } | 371 } |
373 | 372 |
374 /** | 373 /** |
375 * Send a message but ensure that all queued messages are being sent first. | 374 * Send a message but ensure that all queued messages are being sent first. |
401 */ | 400 */ |
402 public void sendMessageImmediate(byte[] msg) throws IOException { | 401 public void sendMessageImmediate(byte[] msg) throws IOException { |
403 synchronized (connectionSemaphore) { | 402 synchronized (connectionSemaphore) { |
404 while (true) { | 403 while (true) { |
405 if (connectionClosed) { | 404 if (connectionClosed) { |
406 throw reasonClosedCause; | 405 throw new IOException("Sorry, this connection is closed.").initCause(reasonClosedCause); |
407 } | 406 } |
408 | 407 |
409 if (!flagKexOngoing) { | 408 if (!flagKexOngoing) { |
410 break; | 409 break; |
411 } | 410 } |