Fixup bad revert of 500

This commit is contained in:
Nick O'Leary 2018-11-02 00:12:44 +00:00
parent 4daba0ae5c
commit ee30733e24
2 changed files with 22 additions and 19 deletions

View File

@ -102,15 +102,15 @@ PubSubClient::PubSubClient(const char* domain, uint16_t port, MQTT_CALLBACK_SIGN
} }
boolean PubSubClient::connect(const char *id) { boolean PubSubClient::connect(const char *id) {
return connect(id,NULL,NULL,0,0,0,0); return connect(id,NULL,NULL,0,0,0,0,1);
} }
boolean PubSubClient::connect(const char *id, const char *user, const char *pass) { boolean PubSubClient::connect(const char *id, const char *user, const char *pass) {
return connect(id,user,pass,0,0,0,0); return connect(id,user,pass,0,0,0,0,1);
} }
boolean PubSubClient::connect(const char *id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage) { boolean PubSubClient::connect(const char *id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage) {
return connect(id,NULL,NULL,willTopic,willQos,willRetain,willMessage); return connect(id,NULL,NULL,willTopic,willQos,willRetain,willMessage,1);
} }
boolean PubSubClient::connect(const char *id, const char *user, const char *pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage) { boolean PubSubClient::connect(const char *id, const char *user, const char *pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage) {
@ -145,9 +145,12 @@ boolean PubSubClient::connect(const char *id, const char *user, const char *pass
uint8_t v; uint8_t v;
if (willTopic) { if (willTopic) {
v = 0x06|(willQos<<3)|(willRetain<<5); v = 0x04|(willQos<<3)|(willRetain<<5);
} else { } else {
v = 0x02; v = 0x00;
}
if (cleanSession) {
v = v|0x02;
} }
if(user != NULL) { if(user != NULL) {

View File

@ -283,20 +283,20 @@ int test_connect_disconnect_connect() {
int main() int main()
{ {
SUITE("Connect"); SUITE("Connect");
test_connect_non_clean_session();
// test_connect_fails_no_network(); test_connect_fails_no_network();
// test_connect_fails_on_no_response(); test_connect_fails_on_no_response();
//
// test_connect_properly_formatted(); test_connect_properly_formatted();
// test_connect_accepts_username_password(); test_connect_non_clean_session();
// test_connect_fails_on_bad_rc(); test_connect_accepts_username_password();
// test_connect_properly_formatted_hostname(); test_connect_fails_on_bad_rc();
// test_connect_properly_formatted_hostname();
// test_connect_accepts_username_no_password();
// test_connect_ignores_password_no_username(); test_connect_accepts_username_no_password();
// test_connect_with_will(); test_connect_ignores_password_no_username();
// test_connect_with_will_username_password(); test_connect_with_will();
// test_connect_disconnect_connect(); test_connect_with_will_username_password();
test_connect_disconnect_connect();
FINISH FINISH
} }