Skip to content

Commit

Permalink
Bugfix duplicte transmisstion
Browse files Browse the repository at this point in the history
closes #24
  • Loading branch information
Christoph Krey committed Apr 19, 2015
1 parent d893cd8 commit 9f01937
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 29 deletions.
4 changes: 2 additions & 2 deletions MQTTClient.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "MQTTClient"
s.version = "0.1.3"
s.version = "0.1.4"
s.summary = "IOS native ObjectiveC MQTT Framework"
s.homepage = "https://github.com/ckrey/MQTT-Client-Framework"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Christoph Krey" => "krey.christoph@gmail.com" }
s.source = { :git => "https://github.com/ckrey/MQTT-Client-Framework.git", :tag => "0.1.3" }
s.source = { :git => "https://github.com/ckrey/MQTT-Client-Framework.git", :tag => "0.1.4" }

s.source_files = "MQTTClient/MQTTClient", "MQTTClient/MQTTClient/**/*.{h,m}"
s.requires_arc = true
Expand Down
2 changes: 1 addition & 1 deletion MQTTClient/MQTTClient/MQTTPersistence.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@property (nonatomic) NSUInteger maxSize;

- (NSUInteger)windowSize:(NSString *)clientId;
- (BOOL)storeMessageForClientId:(NSString *)clientId
- (MQTTFlow *)storeMessageForClientId:(NSString *)clientId
topic:(NSString *)topic
data:(NSData *)data
retainFlag:(BOOL)retainFlag
Expand Down
6 changes: 3 additions & 3 deletions MQTTClient/MQTTClient/MQTTPersistence.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ - (NSUInteger)windowSize:(NSString *)clientId {
return windowSize;
}

- (BOOL)storeMessageForClientId:(NSString *)clientId
- (MQTTFlow *)storeMessageForClientId:(NSString *)clientId
topic:(NSString *)topic
data:(NSData *)data
retainFlag:(BOOL)retainFlag
Expand All @@ -94,9 +94,9 @@ - (BOOL)storeMessageForClientId:(NSString *)clientId
}
flow.deadline = [NSDate dateWithTimeIntervalSinceNow:0];
[self sync];
return true;
return flow;
} else {
return false;
return nil;
}
}

Expand Down
17 changes: 10 additions & 7 deletions MQTTClient/MQTTClient/MQTTSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -637,19 +637,22 @@ - (UInt16)publishData:(NSData*)data
retainFlag:retainFlag
dupFlag:FALSE];
if (qos) {
if (![self.persistence storeMessageForClientId:self.clientId
topic:topic
data:data
retainFlag:retainFlag
qos:qos
msgId:msgId
incomingFlag:NO]) {
MQTTFlow *flow = [self.persistence storeMessageForClientId:self.clientId
topic:topic
data:data
retainFlag:retainFlag
qos:qos
msgId:msgId
incomingFlag:NO];

if (!flow) {
if (DEBUGSESS) NSLog(@"%@ dropping outgoing messages", self);
msgId = 0;
} else {
[self tell];
if ([self.persistence windowSize:self.clientId] <= self.persistence.maxWindowSize) {
[self send:msg];
flow.deadline = [NSDate dateWithTimeIntervalSinceNow:DUPTIMEOUT];
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@property (nonatomic) NSUInteger maxSize;

- (NSUInteger)windowSize:(NSString *)clientId;
- (BOOL)storeMessageForClientId:(NSString *)clientId
- (MQTTFlow *)storeMessageForClientId:(NSString *)clientId
topic:(NSString *)topic
data:(NSData *)data
retainFlag:(BOOL)retainFlag
Expand Down
Binary file modified MQTTClient/dist/MQTTClient.framework/Versions/A/MQTTClient
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion MQTTClient/dist/documentation/html/annotated.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion MQTTClient/dist/documentation/html/classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion MQTTClient/dist/documentation/html/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion MQTTClient/dist/documentation/html/functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ <h3><a class="anchor" id="index_w"></a>- w -</h3><ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion MQTTClient/dist/documentation/html/functions_func.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ <h3><a class="anchor" id="index_u"></a>- u -</h3><ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion MQTTClient/dist/documentation/html/functions_prop.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion MQTTClient/dist/documentation/html/hierarchy.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
15 changes: 12 additions & 3 deletions MQTTClient/dist/documentation/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,24 @@ <h3>License</h3>
<p>All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<p>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</p>
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<h4>Framework</h4>
<p>Framework build using instructions and scripts by Jeff Verkoeyen <a href="https://github.com/jverkoey/iOS-Framework">https://github.com/jverkoey/iOS-Framework</a></p>
<h4>docs</h4>
<p>Documentation generated with doxygen <a href="http://doxygen.org">http://doxygen.org</a> </p>
<p>Documentation generated with doxygen <a href="http://doxygen.org">http://doxygen.org</a></p>
<h4>Comparison MQTT Clients for iOS (incomplete)</h4>
<table class="doxtable">
<tr>
<th>Wrapper</th><th>&mdash;</th><th>-&mdash;</th><th>MQTTKit </th><th>Marquette</th><th>Moscapsule</th><th>Musqueteer</th><th>MQTT-Client</th><th>MqttSDK</th><th>CocoaMQTT </th></tr>
<tr>
<td></td><td></td><td></td><td>Obj-C </td><td>Obj-C </td><td>Swift </td><td>Obj-C </td><td>Obj-C </td><td>Obj-C </td><td>Swift </td></tr>
<tr>
<td>Library</td><td>IBM</td><td>Paho</td><td>Mosquitto</td><td>Mosquitto</td><td>Mosquitto </td><td>Mosquitto </td><td>native </td><td>native </td><td>native </td></tr>
</table>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2324,7 +2324,7 @@ <h2 class="groupheader">Property Documentation</h2>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 9 2015 11:09:53 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Sun Apr 19 2015 13:58:02 for MQTTClient by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
Expand Down

0 comments on commit 9f01937

Please sign in to comment.