-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Socketpool #158
Socketpool #158
Conversation
@anecdata Thought I would try something. This should work with your multi-internet, using the new method. |
|
@anecdata from main |
Non-TLS case works fine... router shows the proper LAN IP address in sequence with the code execution. w00t! |
Nice! |
Oh, after running for a bit, start getting:
Once that happens, no more requests work on that link. Same behavior with only one Ethernet link. I'm not using ConnectionManager in that code, but could try that to see if it handles the pool better. |
What's the code you are using? The pool isn't managed (just like a built-in one isn't). CM should help if you pass that pool in. You would need to use the new branch that allows for tracking multiple... |
The
But, it happens with the existing library too (Scenario "A" in the code below), so it's not unique to this PR (Scenario "B" in the code below). Code...import time
import traceback
import board
import busio
import digitalio
import adafruit_connection_manager
import adafruit_requests
# A -
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
# B -
#from adafruit_wiznet5k_pr158.adafruit_wiznet5k import WIZNET5K
#from adafruit_wiznet5k_pr158.adafruit_wiznet5k_socketpool import SocketPool
time.sleep(3) # wait for serial
URL = "http://wifitest.adafruit.com/testwifi/index.html"
cs = digitalio.DigitalInOut(board.A3)
spi = board.SPI()
radio = WIZNET5K(spi, cs)
# A -
pool = adafruit_connection_manager.get_radio_socketpool(radio)
# B -
#pool = SocketPool(radio)
requests = adafruit_requests.Session(pool, None)
while True:
# eth._debug = True
try:
print("-" * 40)
with requests.get(URL, timeout=15) as r:
print(r.text)
except Exception as ex:
traceback.print_exception(ex, ex, ex.__traceback__)
time.sleep(3) |
This is an attempt to create a real
SocketPool
class and so the interface (radio) can be set per-pool.Old style:
New style: