Skip to content

Commit e0689bd

Browse files
committed
fixed bug preventing t override of the broker via begin() method on ArduinoIoTCloud
1 parent c5ec9a3 commit e0689bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ArduinoIoTCloud.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ int ArduinoIoTCloudClass::begin(ConnectionManager *c, String brokerAddress)
4040
{
4141
connection = c;
4242
Client &connectionClient = c->getClient();
43-
return begin(connectionClient, brokerAddress);
43+
_brokerAddress = brokerAddress;
44+
return begin(connectionClient, _brokerAddress);
4445
}
4546

4647
int ArduinoIoTCloudClass::begin(Client& net, String brokerAddress)
@@ -49,7 +50,6 @@ int ArduinoIoTCloudClass::begin(Client& net, String brokerAddress)
4950
_net = &net;
5051
// store the broker address as class member
5152
_brokerAddress = brokerAddress;
52-
5353
byte thingIdBytes[72];
5454

5555
if (!ECCX08.begin()) {
@@ -296,13 +296,13 @@ void ArduinoIoTCloudClass::connectionCheck() {
296296
switch (iotStatus) {
297297
case IOT_STATUS_IDLE:
298298
if(connection == NULL){
299-
if(!begin(*_net)){
299+
if(!begin(*_net, _brokerAddress)){
300300
debugMessage("Error Starting Arduino Cloud\nTrying again in a few seconds", 0);
301301
iotStatus = IOT_STATUS_CLOUD_ERROR;
302302
return;
303303
}
304304
}else{
305-
if (!begin(connection)) {
305+
if (!begin(connection, _brokerAddress)) {
306306
debugMessage("Error Starting Arduino Cloud\nTrying again in a few seconds", 0);
307307
iotStatus = IOT_STATUS_CLOUD_ERROR;
308308
return;

0 commit comments

Comments
 (0)