Skip to content

Commit 6ca6c73

Browse files
authored
Merge pull request #302 from aws/Issue_295
change append to extend to fix bytestream error
2 parents 90d7b05 + 4b80923 commit 6ca6c73

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

AWSIoTPythonSDK/core/greengrass/discovery/providers.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def discover(self, thingName):
203203
"""
204204
205205
**Description**
206-
206+
207207
Perform the discovery request for the given Greengrass aware device thing name.
208208
209209
**Syntax**
@@ -246,9 +246,9 @@ def _create_tcp_connection(self):
246246

247247
def _create_ssl_connection(self, sock):
248248
self._logger.debug("Creating ssl connection...")
249-
249+
250250
ssl_protocol_version = ssl.PROTOCOL_SSLv23
251-
251+
252252
if self._port == 443:
253253
ssl_context = SSLContextBuilder()\
254254
.with_ca_certs(self._ca_path)\
@@ -366,9 +366,14 @@ def _receive_until(self, ssl_sock, criteria_function, extra_data=None):
366366
start_time = time.time()
367367
response = bytearray()
368368
number_bytes_read = 0
369+
ssl_sock_tmp = None
369370
while True: # Python does not have do-while
370371
try:
371-
response.append(self._convert_to_int_py3(ssl_sock.read(1)))
372+
ssl_sock_tmp = self._convert_to_int_py3(ssl_sock.read(1))
373+
if ssl_sock_tmp is list:
374+
response.extend(ssl_sock_tmp)
375+
else:
376+
response.append(ssl_sock_tmp)
372377
number_bytes_read += 1
373378
except socket.error as err:
374379
if err.errno == ssl.SSL_ERROR_WANT_READ or err.errno == ssl.SSL_ERROR_WANT_WRITE:

0 commit comments

Comments
 (0)