Skip to content

Commit 47dbdc8

Browse files
committed
Don't autoreconnect when signed in in another location
1 parent ab0133a commit 47dbdc8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

yowsup/layers/interface/interface.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from yowsup.layers import YowLayer, YowLayerEvent
22
from yowsup.layers.protocol_iq.protocolentities import IqProtocolEntity
3-
from yowsup.layers.network import YowNetworkLayer
43
from yowsup.layers.auth import YowAuthenticationProtocolLayer
54
from yowsup.layers.protocol_media.protocolentities.iq_requestupload import RequestUploadIqProtocolEntity
65
from yowsup.layers.protocol_media.mediauploader import MediaUploader
76
from yowsup.layers.network.layer import YowNetworkLayer
7+
from yowsup.layers.auth.protocolentities import StreamErrorProtocolEntity
88
from yowsup.layers import EventCallback
99
import inspect
1010
import logging
@@ -85,12 +85,15 @@ def receive(self, entity):
8585
def onStreamError(self, streamErrorEntity):
8686
logger.error(streamErrorEntity)
8787
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
9193
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)
9395
self.toUpper(streamErrorEntity)
96+
self.disconnect()
9497

9598
@EventCallback(YowNetworkLayer.EVENT_STATE_CONNECTED)
9699
def onConnected(self, yowLayerEvent):

0 commit comments

Comments
 (0)