Skip to content

Commit

Permalink
Merge pull request #9 from copy/master
Browse files Browse the repository at this point in the history
fix: broadcast from tun to clients only sends to the last client
  • Loading branch information
benjamincburns authored Jul 26, 2022
2 parents 68878bf + bd5e675 commit 05c01f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions switchedrelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import threading
import logging
import traceback
import functools

from select import poll
from select import POLLIN, POLLOUT, POLLHUP, POLLERR, POLLNVAL
Expand Down Expand Up @@ -66,13 +67,13 @@ def run(self):
mac = buf[0:6]
if mac == BROADCAST or (ord(mac[0]) & 0x1) == 1:
for socket in macmap.values():
def send_message():
def send_message(socket):
try:
socket.rate_limited_downstream(str(buf))
except:
pass

loop.add_callback(send_message)
loop.add_callback(functools.partial(send_message, socket))

elif macmap.get(mac, False):
def send_message():
Expand Down

0 comments on commit 05c01f2

Please sign in to comment.