Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
ds-project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Schulz
ds-project
Commits
4d1c33ae
Commit
4d1c33ae
authored
1 year ago
by
Michael Zanger
Browse files
Options
Downloads
Patches
Plain Diff
win mac compatibility
parent
6d84fed1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server.py
+3
-4
3 additions, 4 deletions
server.py
with
3 additions
and
4 deletions
server.py
+
3
−
4
View file @
4d1c33ae
...
@@ -37,6 +37,7 @@ class Server(multiprocessing.Process):
...
@@ -37,6 +37,7 @@ class Server(multiprocessing.Process):
self
.
server_port
=
server_port
self
.
server_port
=
server_port
self
.
local_servers_cache
=
server_cache
self
.
local_servers_cache
=
server_cache
self
.
local_clients_cache
=
clients_cache
self
.
local_clients_cache
=
clients_cache
self
.
last_heartbeat_timestamp
=
last_heartbeat_timestamp
@staticmethod
@staticmethod
def
get_local_ip_address
():
def
get_local_ip_address
():
...
@@ -104,7 +105,6 @@ class Server(multiprocessing.Process):
...
@@ -104,7 +105,6 @@ class Server(multiprocessing.Process):
else
:
else
:
return
"
Unknown
"
return
"
Unknown
"
def
run
(
self
):
def
run
(
self
):
print
(
self
.
server_id
+
"
:
"
+
"
Up and running
"
)
print
(
self
.
server_id
+
"
:
"
+
"
Up and running
"
)
if
self
.
server_id
==
"
MAIN
"
:
if
self
.
server_id
==
"
MAIN
"
:
...
@@ -169,7 +169,6 @@ class Server(multiprocessing.Process):
...
@@ -169,7 +169,6 @@ class Server(multiprocessing.Process):
except
socket
.
error
:
except
socket
.
error
:
pass
# Error handling for connection errors or timeout
pass
# Error handling for connection errors or timeout
return
acknowledgment_received
return
acknowledgment_received
def
listen_for_heartbeats
(
self
):
def
listen_for_heartbeats
(
self
):
while
True
:
while
True
:
...
@@ -391,11 +390,11 @@ class Server(multiprocessing.Process):
...
@@ -391,11 +390,11 @@ class Server(multiprocessing.Process):
def
listen_for_cache_update
(
self
):
def
listen_for_cache_update
(
self
):
BROADCAST_ADDRESS
=
self
.
get_broadcast_address
()
BROADCAST_ADDRESS
=
self
.
get_broadcast_address
()
BROADCAST_PORT
=
5980
BROADCAST_PORT
=
5980
print
(
"
listen for cache update
"
)
# Local host information
# Local host information
MY_HOST
=
socket
.
gethostname
()
MY_HOST
=
socket
.
gethostname
()
MY_IP
=
socket
.
gethostbyname
(
MY_HOST
)
MY_IP
=
socket
.
gethostbyname
(
MY_HOST
)
print
(
"
listen for cache update
"
)
# Create a UDP socket
# Create a UDP socket
listen_socket
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
listen_socket
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
# Set the socket to broadcast and enable reusing addresses
# Set the socket to broadcast and enable reusing addresses
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment