mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Update examples to use wildcard addresses for network binding and improve connection timeout comments
This commit is contained in:
@ -156,7 +156,7 @@ async def example_production_ready_config() -> None:
|
||||
# Production-ready connection configuration
|
||||
connection_config = ConnectionConfig(
|
||||
max_connections_per_peer=3, # Balance between performance and resource usage
|
||||
connection_timeout=30.0, # Reasonable timeouta
|
||||
connection_timeout=30.0, # Reasonable timeout
|
||||
load_balancing_strategy="round_robin", # Simple, predictable strategy
|
||||
)
|
||||
|
||||
|
||||
@ -104,7 +104,9 @@ async def run(port: int, destination: str, use_varint_format: bool = True) -> No
|
||||
|
||||
# Use optimal address for the client command
|
||||
optimal_addr = get_optimal_binding_address(port)
|
||||
optimal_addr_with_peer = f"{optimal_addr}/p2p/{host_a.get_id().to_string()}"
|
||||
optimal_addr_with_peer = (
|
||||
f"{optimal_addr}/p2p/{host_a.get_id().to_string()}"
|
||||
)
|
||||
print(
|
||||
f"\nRun this from the same folder in another console:\n\n"
|
||||
f"identify-demo -d {optimal_addr_with_peer}\n"
|
||||
@ -119,7 +121,9 @@ async def run(port: int, destination: str, use_varint_format: bool = True) -> No
|
||||
|
||||
# Use optimal address for the client command
|
||||
optimal_addr = get_optimal_binding_address(port)
|
||||
optimal_addr_with_peer = f"{optimal_addr}/p2p/{host_a.get_id().to_string()}"
|
||||
optimal_addr_with_peer = (
|
||||
f"{optimal_addr}/p2p/{host_a.get_id().to_string()}"
|
||||
)
|
||||
print(
|
||||
f"\nRun this from the same folder in another console:\n\n"
|
||||
f"identify-demo -d {optimal_addr_with_peer}\n"
|
||||
|
||||
Reference in New Issue
Block a user