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
f-interop-contributors
utils
Commits
dc1236f1
Commit
dc1236f1
authored
Oct 27, 2017
by
Federico Sismondi
Browse files
fix error where rmq crashes trying to close channel
parent
75c304e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
interop_cli.py
View file @
dc1236f1
...
...
@@ -39,7 +39,6 @@ MESSAGE_TYPES_NOT_ECHOED = [
MsgPacketInjectRaw
,
]
session_profile
=
OrderedDict
(
{
'user_name'
:
"Walter White"
,
...
...
@@ -297,6 +296,7 @@ def exit():
"""
_exit
()
@
cli
.
command
()
def
download_network_traces
():
"""
...
...
@@ -387,6 +387,7 @@ def _handle_get_testcase_list():
else
:
_echo_error
(
'No connection established'
)
def
_handle_action_testsuite_start
():
if
click
.
confirm
(
'Do you want START test suite?'
):
msg
=
MsgTestSuiteStart
()
...
...
@@ -518,12 +519,15 @@ def enter_debug_context():
"""
global
message_handles_options
message_handles_options
.
update
(
{
'send_skip_tc_coap_core_11'
:
send_skip_tescase_coap_core_11
,
}
debug_actions
=
{
'send_skip_tc_coap_core_11'
:
send_skip_tescase_coap_core_11
,
'snif1'
:
snif1
,
'snif2'
:
snif2
,
'snif3'
:
snif3
,
}
message_handles_options
.
update
(
debug_actions
)
)
_echo_session_helper
(
"Entering debugger context, added the following actions: %s"
%
debug_actions
)
@
cli
.
command
()
...
...
@@ -557,6 +561,7 @@ def check_connection():
_echo_dispatcher
(
'connection is %s'
%
'OK'
if
conn_ok
else
'not OK'
)
return
conn_ok
@
cli
.
command
()
def
get_session_status
():
"""
...
...
@@ -995,7 +1000,7 @@ def _echo_log_message(msg):
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# debugging
message
s
# debugging
action
s
def
send_skip_tescase_coap_core_11
():
_echo_input
(
"Executing debug message %s"
%
"send_skip_tescase_coap_core_11"
)
...
...
@@ -1006,6 +1011,26 @@ def send_skip_tescase_coap_core_11():
publish_message
(
msg
)
def
snif1
():
_echo_input
(
"Executing debug message %s"
%
"start sniffing, file name PCAP_TEST.pcap"
)
msg
=
MsgSniffingStart
(
capture_id
=
'PCAP_TEST'
,
filter_if
=
'tun0'
,
filter_proto
=
'udp'
)
publish_message
(
msg
)
def
snif2
():
_echo_input
(
"Executing debug message %s"
%
"stop sniffing"
)
msg
=
MsgSniffingStop
()
publish_message
(
msg
)
def
snif3
():
_echo_input
(
"Executing debug message %s"
%
"get last sniffed file"
)
msg
=
MsgSniffingGetCaptureLast
()
publish_message
(
msg
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# some auxiliary functions
...
...
rmq_handler.py
View file @
dc1236f1
...
...
@@ -55,7 +55,7 @@ try:
except
KeyError
as
e
:
print
(
' Cannot retrieve environment variables for AMQP connection, using default url: %s, exchange: %s'
%
(
AMQP_URL
,
AMQP_EXCHANGE
))
AMQP_URL
,
AMQP_EXCHANGE
))
# skip natural LogRecord attributes
# http://docs.python.org/library/logging.html#logrecord-attributes
...
...
@@ -240,12 +240,12 @@ class RabbitMQHandler(logging.Handler):
try
:
self
.
channel
.
close
()
except
AttributeError
:
except
(
AttributeError
,
pika
.
exceptions
.
ConnectionClosed
)
:
pass
try
:
self
.
connection
.
close
()
except
AttributeError
:
except
(
AttributeError
,
pika
.
exceptions
.
ConnectionClosed
)
:
pass
finally
:
...
...
Write
Preview
Markdown
is supported
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