Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joanne Hugé
re6stnet
Commits
fba6ae8c
Commit
fba6ae8c
authored
Feb 17, 2022
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start adding comments where necessary
parent
f1e95660
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
re6st/ctl.py
re6st/ctl.py
+13
-0
No files found.
re6st/ctl.py
View file @
fba6ae8c
...
@@ -193,6 +193,8 @@ class Babel(object):
...
@@ -193,6 +193,8 @@ class Babel(object):
self
.
locked
=
set
()
self
.
locked
=
set
()
self
.
reset
()
self
.
reset
()
# Create new socket, try assigning it next time select is called
# Called at __init__ and then if current socket fails
def
reset
(
self
):
def
reset
(
self
):
try
:
try
:
del
self
.
socket
,
self
.
request_dump
del
self
.
socket
,
self
.
request_dump
...
@@ -203,6 +205,10 @@ class Babel(object):
...
@@ -203,6 +205,10 @@ class Babel(object):
self
.
read_buffer
.
want
(
header
.
size
)
self
.
read_buffer
.
want
(
header
.
size
)
s
=
socket
.
socket
(
socket
.
AF_UNIX
,
s
=
socket
.
socket
(
socket
.
AF_UNIX
,
socket
.
SOCK_STREAM
|
socket
.
SOCK_CLOEXEC
)
socket
.
SOCK_STREAM
|
socket
.
SOCK_CLOEXEC
)
# Will be called instead of default select function until connection
# with new socket succeeds
# If it succeeds, default select gets called at the end and gets
# set again as self.select
def
select
(
*
args
):
def
select
(
*
args
):
try
:
try
:
s
.
connect
(
self
.
socket_path
)
s
.
connect
(
self
.
socket_path
)
...
@@ -217,7 +223,11 @@ class Babel(object):
...
@@ -217,7 +223,11 @@ class Babel(object):
self
.
select
=
select
self
.
select
=
select
self
.
close
=
s
.
close
self
.
close
=
s
.
close
# This function is only called after reset until connection to new socket is
# successful, then self.send(Dump(11)) is used
def
request_dump
(
self
):
def
request_dump
(
self
):
# If connection to new socket is currently failing,
# then mark the dump as handled by calling handle_dump with empty parameters
if
self
.
select
({},
{},
()):
if
self
.
select
({},
{},
()):
self
.
handle_dump
((),
(),
(),
())
self
.
handle_dump
((),
(),
(),
())
else
:
else
:
...
@@ -228,6 +238,9 @@ class Babel(object):
...
@@ -228,6 +238,9 @@ class Babel(object):
def
send
(
self
,
packet
):
def
send
(
self
,
packet
):
packet
.
write
(
self
.
write_buffer
)
packet
.
write
(
self
.
write_buffer
)
# Adds socket to the list of read / write file descriptors
# to poll in the main loop
# Assigns _read and _write callbacks to socket
def
select
(
self
,
r
,
w
,
t
):
def
select
(
self
,
r
,
w
,
t
):
s
=
self
.
socket
s
=
self
.
socket
r
[
s
]
=
self
.
_read
r
[
s
]
=
self
.
_read
...
...
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