Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
ccdf1b01
Commit
ccdf1b01
authored
Apr 15, 2013
by
D1plo1d
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing legacy MDNS code that wasn't needed for the current MDNS setup.
parent
86ba7b9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
46 deletions
+0
-46
pronserve.py
pronserve.py
+0
-46
No files found.
pronserve.py
View file @
ccdf1b01
...
...
@@ -61,7 +61,6 @@ auth = basic_auth.authenticate('auth_realm', authenticator, user_extractor)
# Routing
# -------------------------------------------------
class
RootHandler
(
tornado
.
web
.
RequestHandler
):
def
get
(
self
):
self
.
render
(
"index.html"
)
...
...
@@ -114,49 +113,6 @@ application = tornado.web.Application([
],
**
settings
)
# MDNS Server
# -------------------------------------------------
class
MdnsServer
(
object
):
def
__init__
(
self
):
self
.
servers
=
set
()
# IPV4
# SocketServer.TCPServer((HOST, PORT), MyTCPHandler)
# sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# sock.bind(('0.0.0.0', 5353))
# sock.listen(5)
# self.sockets.add(sock)
# self.poll_rate = 0.01 # seconds
# IPV4
server
=
SocketServer
.
UDPServer
((
'0.0.0.0'
,
5353
),
MdnsHandler
,
False
)
#server.allow_reuse_address = True;
server
.
socket
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
server
.
socket
.
bind
((
'0.0.0.0'
,
5353
))
# server.server_bind() # Manually bind, to support allow_reuse_address
server
.
server_activate
()
# (see above comment)
server
.
serve_forever
()
#server.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self
.
servers
.
add
(
server
)
# IPV6
# sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
# sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# sock.bind(('0:0:0:0:0:0:0:0', 5353))
# sock.listen(5)
# self.sockets.add(sock)
class
MdnsHandler
(
SocketServer
.
BaseRequestHandler
):
def
handle
(
self
):
data
=
self
.
request
[
0
]
.
strip
()
socket
=
self
.
request
[
1
]
print
"{} wrote:"
.
format
(
self
.
client_address
[
0
])
print
data
socket
.
sendto
(
data
.
upper
(),
self
.
client_address
)
# Pronserve: Server-specific functionality
# -------------------------------------------------
...
...
@@ -166,13 +122,11 @@ class Pronserve(pronsole.pronsole):
pronsole
.
pronsole
.
__init__
(
self
)
self
.
settings
.
sensor_names
=
{
'T'
:
'extruder'
,
'B'
:
'bed'
}
self
.
stdout
=
sys
.
stdout
#self.init_Settings()
self
.
ioloop
=
tornado
.
ioloop
.
IOLoop
.
instance
()
self
.
clients
=
set
()
self
.
settings
.
sensor_poll_rate
=
0.3
# seconds
self
.
sensors
=
{
'extruder'
:
-
1
,
'bed'
:
-
1
}
self
.
load_default_rc
()
#self.mdns = MdnsServer()
services
=
({
'type'
:
'_construct._tcp'
,
'port'
:
8888
,
'domain'
:
"local."
})
self
.
mdns
=
mdns
.
publisher
()
.
save_group
({
'name'
:
'pronserve'
,
'services'
:
services
})
...
...
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