archive
/
ipc-unix
Archived
1
Fork 0

Rename constant so it makes more sense

This commit is contained in:
Jake Howard 2018-12-08 01:15:07 +00:00
parent 07affb4c36
commit c7af71456e
Signed by: jake
GPG Key ID: 57AFB45680EDD477
2 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import select
import socket import socket
import ujson import ujson
from ipc_unix.utils import DEFAULT_SOCKET_TIMEOUT, read_payload, socket_has_data from ipc_unix.utils import DEFAULT_SOCKET_READ_TIMEOUT, read_payload, socket_has_data
class Subscriber: class Subscriber:
@ -55,7 +55,7 @@ class Publisher:
self.accept_new_connection() self.accept_new_connection()
_, writable, errorable = select.select( _, writable, errorable = select.select(
[], self.connections, [], DEFAULT_SOCKET_TIMEOUT [], self.connections, [], DEFAULT_SOCKET_READ_TIMEOUT
) )
dead_sockets = [] dead_sockets = []

View File

@ -3,10 +3,10 @@ import select
import ujson import ujson
BUFFER_SIZE = 4096 BUFFER_SIZE = 4096
DEFAULT_SOCKET_TIMEOUT = 0.1 DEFAULT_SOCKET_READ_TIMEOUT = 0.1
def socket_has_data(sock, timeout=DEFAULT_SOCKET_TIMEOUT) -> bool: def socket_has_data(sock, timeout=DEFAULT_SOCKET_READ_TIMEOUT) -> bool:
readable, _, _ = select.select([sock], [], [], timeout) readable, _, _ = select.select([sock], [], [], timeout)
return sock in readable return sock in readable