Skip to content

Commit 6d074ac

Browse files
committed
close process after failed connect
1 parent c546f24 commit 6d074ac

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/YunMQTTClient.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ boolean YunMQTTClient::connect(const char * clientId, const char * username, con
3838
String ret = this->process.readStringUntil('\n');
3939
this->alive = ret.equals("ca");
4040

41-
return this->connected();
41+
if(!this->alive) {
42+
this->process.close();
43+
return false;
44+
} else {
45+
return true;
46+
}
4247
}
4348

4449
void YunMQTTClient::publish(String topic) {

0 commit comments

Comments
 (0)