Skip to content

Commit

Permalink
Merge pull request #175 from skalenetwork/bug/174-sgx-timeout
Browse files Browse the repository at this point in the history
#174 add timeout options to zmq socket
  • Loading branch information
olehnikolaiev authored Oct 30, 2024
2 parents 6930bb8 + 5e03c0f commit 777c69a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions sgx/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

DEFAULT_TIMEOUT = 10
SGX_RESPONSE_TIMEOUT = 60 # seconds
SGX_ZMQ_RESPONSE_TIMEOUT_MS = 5000

CSR_FILENAME = 'sgx.csr'
KEY_FILENAME = 'sgx.key'
Expand Down
3 changes: 3 additions & 0 deletions sgx/sgx_zmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

from sgx.constants import (
DEFAULT_TIMEOUT,
SGX_ZMQ_RESPONSE_TIMEOUT_MS,
CRT_FILENAME,
KEY_FILENAME
)
Expand Down Expand Up @@ -270,6 +271,8 @@ def __send_request(self, method, params=None):
socket_p_id = self.ctx.socket(zmq.DEALER)
socket_p_id.setsockopt_string(zmq.IDENTITY, "135:14603077656239261618")
socket_p_id.setsockopt(zmq.LINGER, 0)
socket_p_id.setsockopt(zmq.SNDTIMEO, SGX_ZMQ_RESPONSE_TIMEOUT_MS)
socket_p_id.setsockopt(zmq.RCVTIMEO, SGX_ZMQ_RESPONSE_TIMEOUT_MS)
socket_p_id.connect(self.sgx_endpoint)
self.sockets[p_id] = socket_p_id
socket = self.sockets[p_id]
Expand Down

0 comments on commit 777c69a

Please sign in to comment.