Skip to content

Commit

Permalink
Merge pull request #302 from aws/Issue_295
Browse files Browse the repository at this point in the history
change append to extend to fix bytestream error
  • Loading branch information
jmklix authored Mar 3, 2022
2 parents 90d7b05 + 4b80923 commit 6ca6c73
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions AWSIoTPythonSDK/core/greengrass/discovery/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def discover(self, thingName):
"""
**Description**
Perform the discovery request for the given Greengrass aware device thing name.
**Syntax**
Expand Down Expand Up @@ -246,9 +246,9 @@ def _create_tcp_connection(self):

def _create_ssl_connection(self, sock):
self._logger.debug("Creating ssl connection...")

ssl_protocol_version = ssl.PROTOCOL_SSLv23

if self._port == 443:
ssl_context = SSLContextBuilder()\
.with_ca_certs(self._ca_path)\
Expand Down Expand Up @@ -366,9 +366,14 @@ def _receive_until(self, ssl_sock, criteria_function, extra_data=None):
start_time = time.time()
response = bytearray()
number_bytes_read = 0
ssl_sock_tmp = None
while True: # Python does not have do-while
try:
response.append(self._convert_to_int_py3(ssl_sock.read(1)))
ssl_sock_tmp = self._convert_to_int_py3(ssl_sock.read(1))
if ssl_sock_tmp is list:
response.extend(ssl_sock_tmp)
else:
response.append(ssl_sock_tmp)
number_bytes_read += 1
except socket.error as err:
if err.errno == ssl.SSL_ERROR_WANT_READ or err.errno == ssl.SSL_ERROR_WANT_WRITE:
Expand Down

0 comments on commit 6ca6c73

Please sign in to comment.