|
91 | 91 | from debug import logger |
92 | 92 | from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery, sqlStoredProcedure, sql_ready |
93 | 93 | from inventory import Inventory |
| 94 | +from network import BMConnectionPool |
94 | 95 | from network.threads import StoppableThread |
95 | 96 | from six.moves import queue |
96 | 97 | from version import softwareVersion |
@@ -1441,6 +1442,33 @@ def HandleClientStatus(self): |
1441 | 1442 | 'softwareVersion': softwareVersion |
1442 | 1443 | } |
1443 | 1444 |
|
| 1445 | + @command('listConnections') |
| 1446 | + def HandleListConnections(self): |
| 1447 | + """ |
| 1448 | + Returns bitmessage connection information as dict with keys *inbound, |
| 1449 | + *outbound. |
| 1450 | + """ |
| 1451 | + inboundConnections = [] |
| 1452 | + outboundConnections = [] |
| 1453 | + for i in BMConnectionPool().inboundConnections.values(): |
| 1454 | + inboundConnections.append({ |
| 1455 | + 'host': i.destination.host, |
| 1456 | + 'port': i.destination.port, |
| 1457 | + 'fullyEstablished': i.fullyEstablished, |
| 1458 | + 'userAgent': str(i.userAgent) |
| 1459 | + }) |
| 1460 | + for i in BMConnectionPool().outboundConnections.values(): |
| 1461 | + outboundConnections.append({ |
| 1462 | + 'host': i.destination.host, |
| 1463 | + 'port': i.destination.port, |
| 1464 | + 'fullyEstablished': i.fullyEstablished, |
| 1465 | + 'userAgent': str(i.userAgent) |
| 1466 | + }) |
| 1467 | + return { |
| 1468 | + 'inbound': inboundConnections, |
| 1469 | + 'outbound': outboundConnections |
| 1470 | + } |
| 1471 | + |
1444 | 1472 | @command('helloWorld') |
1445 | 1473 | def HandleHelloWorld(self, a, b): |
1446 | 1474 | """Test two string params""" |
|
0 commit comments