Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TCPlivePLOT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CPUnetLOG
TCPlivePLOT
Commits
ac65b253
Commit
ac65b253
authored
Sep 24, 2016
by
Michael König
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix threading
parent
4a7aadbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
tcpliveplot/backends/input/socket.py
tcpliveplot/backends/input/socket.py
+13
-4
No files found.
tcpliveplot/backends/input/socket.py
View file @
ac65b253
...
...
@@ -2,6 +2,7 @@
import
time
import
socket
import
threading
from
ipaddress
import
ip_address
from
collections
import
deque
...
...
@@ -25,6 +26,7 @@ class SocketInput(InputBase):
self
.
incomeBuffer
=
deque
()
self
.
connectionUp
=
False
self
.
socketUp
=
False
self
.
__stopped
=
threading
.
Event
()
ip
,
separator
,
port
=
self
.
options
.
logServer
.
rpartition
(
':'
)
if
(
':'
not
in
self
.
options
.
logServer
or
port
is
''
):
...
...
@@ -43,7 +45,10 @@ class SocketInput(InputBase):
self
.
createSocket
()
while
not
self
.
connectToServer
():
pass
if
self
.
__stopped
:
return
else
:
pass
def
createSocket
(
self
):
try
:
...
...
@@ -63,10 +68,10 @@ class SocketInput(InputBase):
return
True
except
socket
.
error
:
print
(
"Error: Could not connect to "
+
self
.
dst
+
". Retrying in "
+
str
(
LOGSERVER_CONNECT_RETRY_TIME
)
+
"s ..."
)
time
.
sleep
(
LOGSERVER_CONNECT_RETRY_TIME
)
self
.
__stopped
.
wait
(
LOGSERVER_CONNECT_RETRY_TIME
)
return
False
else
:
time
.
sleep
(
LOGSERVER_CONNECT_RETRY_TIME
)
self
.
__stopped
.
wait
(
LOGSERVER_CONNECT_RETRY_TIME
)
return
False
def
reconnectToServer
(
self
):
...
...
@@ -75,9 +80,13 @@ class SocketInput(InputBase):
self
.
createSocket
()
while
not
self
.
connectToServer
():
pass
if
self
.
__stopped
:
return
else
:
pass
def
tearDown
(
self
):
self
.
__stopped
.
set
()
self
.
socket
.
close
()
pass
...
...
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