Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
telemersion
Telemersive Switchboard
Commits
89037a10
Commit
89037a10
authored
Jun 02, 2021
by
maybites
Browse files
fixed logger
added try-exceptions
parent
8ddaf8a4
Changes
5
Hide whitespace changes
Inline
Side-by-side
proxies/udp_many2manybi.py
View file @
89037a10
...
...
@@ -51,7 +51,10 @@ class Many2ManyBiProxy(multiprocessing.Process):
if
(
self
.
active_endpoints
[
addr
]
+
self
.
timeout
)
<
time
.
time
():
del
self
.
active_endpoints
[
addr
]
else
:
self
.
sock
.
sendto
(
my_data
,
addr
)
try
:
self
.
sock
.
sendto
(
my_data
,
addr
)
except
BlockingIOError
:
continue
except
:
self
.
logger
.
exception
(
'Oops, something went wrong!'
,
extra
=
{
'stack'
:
True
})
...
...
proxies/udp_one2manybi.py
View file @
89037a10
...
...
@@ -66,7 +66,10 @@ class One2ManyBiProxy(multiprocessing.Process):
if
(
self
.
active_endpoints
[
one_addr
]
+
self
.
timeout
)
<
time
.
time
():
del
self
.
active_endpoints
[
one_addr
]
else
:
self
.
source
.
sendto
(
many_data
,
one_addr
)
try
:
self
.
sink
.
sendto
(
many_data
,
one_addr
)
except
BlockingIOError
:
continue
elif
sock
.
getsockname
()[
1
]
==
self
.
one_port
:
# one sends to many
one_data
,
one_addr
=
sock
.
recvfrom
(
65536
)
...
...
@@ -78,7 +81,10 @@ class One2ManyBiProxy(multiprocessing.Process):
if
(
self
.
active_endpoints
[
many_addr
]
+
self
.
timeout
)
<
time
.
time
():
del
self
.
active_endpoints
[
many_addr
]
else
:
self
.
sink
.
sendto
(
one_data
,
many_addr
)
try
:
self
.
sink
.
sendto
(
one_data
,
many_addr
)
except
BlockingIOError
:
continue
else
:
print
(
'We should not ever reach that point'
)
except
:
...
...
proxies/udp_one2manymo.py
View file @
89037a10
...
...
@@ -68,7 +68,10 @@ class One2ManyMoProxy(multiprocessing.Process):
# send data to remaining sink_clients
for
client
in
self
.
sink_clients
.
keys
():
self
.
sink
.
sendto
(
data
,
client
)
try
:
self
.
sink
.
sendto
(
data
,
client
)
except
BlockingIOError
:
continue
except
:
self
.
logger
.
exception
(
'Oops, something went wrong!'
,
extra
=
{
'stack'
:
True
})
...
...
proxies/udp_one2onebi.py
View file @
89037a10
...
...
@@ -49,10 +49,13 @@ class One2OneBiProxy(multiprocessing.Process):
# transmit data
if
client1
and
client2
:
if
addr
==
client1
:
self
.
sock
.
sendto
(
data
,
client2
)
elif
addr
==
client2
:
self
.
sock
.
sendto
(
data
,
client1
)
try
:
if
addr
==
client1
:
self
.
sock
.
sendto
(
data
,
client2
)
elif
addr
==
client2
:
self
.
sock
.
sendto
(
data
,
client1
)
except
BlockingIOError
:
continue
except
:
self
.
logger
.
exception
(
'Oops, something went wrong!'
,
extra
=
{
'stack'
:
True
})
...
...
switchboard.py
View file @
89037a10
...
...
@@ -104,13 +104,13 @@ def start_proxy():
if
proxydef
[
'type'
]
==
'one2oneBi'
:
obj
=
proxies
.
One2OneBiProxy
(
listen_port
=
proxydef
[
'port'
],
logger
=
app
.
logger
)
elif
proxydef
[
'type'
]
==
'one2manyMo'
:
obj
=
proxies
.
One2ManyMoProxy
(
listen_port
=
proxydef
[
'port'
],
send_port
=
proxydef
[
'port'
]
+
1
)
obj
=
proxies
.
One2ManyMoProxy
(
listen_port
=
proxydef
[
'port'
],
send_port
=
proxydef
[
'port'
]
+
1
,
logger
=
app
.
logger
)
elif
proxydef
[
'type'
]
==
'mirror'
:
obj
=
proxies
.
MirrorProxy
(
listen_port
=
proxydef
[
'port'
])
obj
=
proxies
.
MirrorProxy
(
listen_port
=
proxydef
[
'port'
]
,
logger
=
app
.
logger
)
elif
proxydef
[
'type'
]
==
'one2manyBi'
:
obj
=
proxies
.
One2ManyBiProxy
(
one_port
=
proxydef
[
'port'
],
many_port
=
proxydef
[
'port'
]
+
1
)
obj
=
proxies
.
One2ManyBiProxy
(
one_port
=
proxydef
[
'port'
],
many_port
=
proxydef
[
'port'
]
+
1
,
logger
=
app
.
logger
)
elif
proxydef
[
'type'
]
==
'many2manyBi'
:
obj
=
proxies
.
Many2ManyBiProxy
(
listen_port
=
proxydef
[
'port'
])
obj
=
proxies
.
Many2ManyBiProxy
(
listen_port
=
proxydef
[
'port'
]
,
logger
=
app
.
logger
)
else
:
response
=
{
'status'
:
'Error'
,
'msg'
:
'An unknown error occurred'
}
return
r
(
json
.
dumps
(
response
),
422
)
...
...
froehlich martin - mfroehli
@mfroehli
mentioned in issue
#1 (closed)
·
Jun 08, 2021
mentioned in issue
#1 (closed)
mentioned in issue #1
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment