{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/paho.mqtt.embedded-c/issues/49","repository_url":"https://api.github.com/repos/eclipse/paho.mqtt.embedded-c","labels_url":"https://api.github.com/repos/eclipse/paho.mqtt.embedded-c/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/paho.mqtt.embedded-c/issues/49/comments","events_url":"https://api.github.com/repos/eclipse/paho.mqtt.embedded-c/issues/49/events","html_url":"https://github.com/eclipse/paho.mqtt.embedded-c/issues/49","id":179231622,"number":49,"title":"MQTTClient.h - (re)subscribe to the same topic filter failed","user":{"login":"miketran78727","id":11527566,"avatar_url":"https://avatars.githubusercontent.com/u/11527566?v=3","gravatar_id":"","url":"https://api.github.com/users/miketran78727","html_url":"https://github.com/miketran78727","followers_url":"https://api.github.com/users/miketran78727/followers","following_url":"https://api.github.com/users/miketran78727/following{/other_user}","gists_url":"https://api.github.com/users/miketran78727/gists{/gist_id}","starred_url":"https://api.github.com/users/miketran78727/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miketran78727/subscriptions","organizations_url":"https://api.github.com/users/miketran78727/orgs","repos_url":"https://api.github.com/users/miketran78727/repos","events_url":"https://api.github.com/users/miketran78727/events{/privacy}","received_events_url":"https://api.github.com/users/miketran78727/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-26T13:41:32Z","updated_at":"2016-10-11T23:41:18Z","closed_at":null,"body":"Steps to reproduce the issue (e.g TI CC3200):\r\n````\r\nvoid loop() {\r\n\tint rc = 0;\r\n\tif (!client.isConnected()) {\r\n\t\trc = connect();\r\n\t}\r\n\t\r\n\tif (rc == 0) {\r\n\t\tchar json[56];\r\n\t\tsprintf(json, \"{\\\"d\\\":{\\\"count\\\":%d}}\\0\", count++);\r\n\t\tSerial.print(\"Publishing: \");\r\n\t\tSerial.println(json);\r\n\t\tMQTT::Message message;\r\n\t\tmessage.qos = MQTT::QOS0; \r\n\t\tmessage.retained = false;\r\n\t\tmessage.payload = json; \r\n\t\tmessage.payloadlen = strlen(json);\r\n\t\trc = client.publish(pubtopic, message);\r\n\t\tif (rc != 0) {\r\n\t\t\tSerial.print(\"Message publish failed with return code : \");\r\n\t\t\tSerial.println(rc);\r\n\t\t}\r\n\t\t\r\n\t\tSerial.print(\"Subscribing to topic : \");\r\n\t\tSerial.print(subtopic);\r\n\t\trc = client.subscribe(subtopic, MQTT::QOS1, messageArrived);\r\n\t\tif (rc != 0) {\r\n\t\t\tSerial.print(\" Subscribe failed with return code : \");\r\n\t\t\tSerial.println(rc);\r\n\t\t} else {\r\n\t\t\tSerial.println(\" ...OK\");\r\n\t\t\tclient.yield(1000);\r\n\t\t\tSerial.print(\"Unsubscribing from topic : \");\r\n\t\t\tSerial.println(subtopic);\r\n\t\t\trc = client.unsubscribe(subtopic);\r\n\t\t\tif (rc != 0) {\r\n\t\t\t\tSerial.print(\"  Unsubscribe failed with return code : \");\r\n\t\t\t\tSerial.println(rc);\r\n\t\t\t} else {\r\n\t\t\t\tSerial.println(\" ...OK\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (rc != 0) {\r\n\t\t\tclient.yield(60000);\r\n\t\t}\r\n\r\n\t}\r\n\t\r\n\t// Wait 10 seconds before publishing again\r\n\tclient.yield(10000);\r\n}\r\n````\r\n\r\nAfter iteration MAX_MESSAGE_HANDLERS (default is 5) the subscribe() failed as shown in the console:\r\n````\r\nSubscribe failed with return code : 1\r\n````\r\nI am testing my simple fix for this issue on CC3200,..\r\n"},"comment":{"url":"https://api.github.com/repos/eclipse/paho.mqtt.embedded-c/issues/comments/253078873","html_url":"https://github.com/eclipse/paho.mqtt.embedded-c/issues/49#issuecomment-253078873","issue_url":"https://api.github.com/repos/eclipse/paho.mqtt.embedded-c/issues/49","id":253078873,"user":{"login":"icraggs","id":10279016,"avatar_url":"https://avatars.githubusercontent.com/u/10279016?v=3","gravatar_id":"","url":"https://api.github.com/users/icraggs","html_url":"https://github.com/icraggs","followers_url":"https://api.github.com/users/icraggs/followers","following_url":"https://api.github.com/users/icraggs/following{/other_user}","gists_url":"https://api.github.com/users/icraggs/gists{/gist_id}","starred_url":"https://api.github.com/users/icraggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icraggs/subscriptions","organizations_url":"https://api.github.com/users/icraggs/orgs","repos_url":"https://api.github.com/users/icraggs/repos","events_url":"https://api.github.com/users/icraggs/events{/privacy}","received_events_url":"https://api.github.com/users/icraggs/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T23:41:18Z","updated_at":"2016-10-11T23:41:18Z","body":"Hi Mike.  Thanks, I've merged the fix for the C++ client.  I notice that the same problem exists in the C version, which is not surprising as they are based on the same code.  I'll leave this issue open until I've fixed the other code too."}}
{"actor":{"display_login":"icraggs"}}