|
1 | 1 | from yowsup.layers import YowLayer, YowLayerEvent |
2 | 2 | from yowsup.layers.protocol_iq.protocolentities import IqProtocolEntity |
3 | | -from yowsup.layers.network import YowNetworkLayer |
4 | 3 | from yowsup.layers.auth import YowAuthenticationProtocolLayer |
5 | 4 | from yowsup.layers.protocol_media.protocolentities.iq_requestupload import RequestUploadIqProtocolEntity |
6 | 5 | from yowsup.layers.protocol_media.mediauploader import MediaUploader |
7 | 6 | from yowsup.layers.network.layer import YowNetworkLayer |
| 7 | +from yowsup.layers.auth.protocolentities import StreamErrorProtocolEntity |
8 | 8 | from yowsup.layers import EventCallback |
9 | 9 | import inspect |
10 | 10 | import logging |
@@ -85,12 +85,15 @@ def receive(self, entity): |
85 | 85 | def onStreamError(self, streamErrorEntity): |
86 | 86 | logger.error(streamErrorEntity) |
87 | 87 | if self.getProp(self.__class__.PROP_RECONNECT_ON_STREAM_ERR, True): |
88 | | - logger.info("Initiating reconnect") |
89 | | - self.reconnect = True |
90 | | - self.disconnect() |
| 88 | + if streamErrorEntity.getErrorType() == StreamErrorProtocolEntity.TYPE_CONFLICT: |
| 89 | + logger.warn("Not reconnecting because you signed in in another location") |
| 90 | + else: |
| 91 | + logger.info("Initiating reconnect") |
| 92 | + self.reconnect = True |
91 | 93 | else: |
92 | | - logger.warn("No reconnecting because property %s is not set" % self.__class__.PROP_RECONNECT_ON_STREAM_ERR) |
| 94 | + logger.warn("Not reconnecting because property %s is not set" % self.__class__.PROP_RECONNECT_ON_STREAM_ERR) |
93 | 95 | self.toUpper(streamErrorEntity) |
| 96 | + self.disconnect() |
94 | 97 |
|
95 | 98 | @EventCallback(YowNetworkLayer.EVENT_STATE_CONNECTED) |
96 | 99 | def onConnected(self, yowLayerEvent): |
|
0 commit comments