soc.2009.transport: 9db11b5e: Fixed segfault when connection was lost ...
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Fri Jul 24 06:51:18 EDT 2009
-----------------------------------------------------------------
Revision: 9db11b5e93d2d4f2fe6093ba69b59a679c86ace3
Ancestor: fda812db52e35009561239c8ea876d1e1c36564d
Author: hanzz at soc.pidgin.im
Date: 2009-07-24T07:45:36
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/9db11b5e93d2d4f2fe6093ba69b59a679c86ace3
Modified files:
main.cpp main.h
ChangeLog:
Fixed segfault when connection was lost and transport tried to reconnect in recursive loop.
-------------- next part --------------
============================================================
--- main.cpp 23459f9a99aaf4f6eeed26d9ac489f4b31b8c0ba
+++ main.cpp 9aecfa93dbea38978e2737266af68c015e898ad7
@@ -557,6 +557,11 @@ static gboolean iter3(gpointer data){
}
+static gboolean transportReconnect(gpointer data) {
+ GlooxMessageHandler::instance()->transportConnect();
+ return FALSE;
+}
+
/*
* Called by notifier when new data can be received from socket
* TODO: rename me!
@@ -1319,8 +1324,15 @@ void GlooxMessageHandler::onDisconnect(C
Log().Get("gloox") << j->streamError();
Log().Get("gloox") << j->streamErrorText("default text");
if (j->streamError()==0 || j->streamError()==24){
- j->connect(false);
- int mysock = dynamic_cast<ConnectionTCPClient*>( j->connectionImpl() )->socket();
+ Log().Get("gloox") << j->streamErrorText("trying to reconnect after 3 seconds");
+ g_timeout_add_seconds(3,&transportReconnect, NULL);
+ }
+}
+
+void GlooxMessageHandler::transportConnect() {
+ j->connect(false);
+ int mysock = dynamic_cast<ConnectionTCPClient*>( j->connectionImpl() )->socket();
+ if (mysock > 0) {
connectIO = g_io_channel_unix_new(mysock);
g_io_add_watch(connectIO,(GIOCondition) READ_COND,&iter,NULL);
}
============================================================
--- main.h 7806f6731b8f3c126e257f51a1b98d2b9fc82717
+++ main.h 0bf5e83531a63bae74107496f5d4cf859d34b8e7
@@ -195,6 +195,7 @@ public:
void handlePresence(const Presence &presence);
void handleSubscription(const Subscription &stanza);
void signedOn(PurpleConnection *gc,gpointer unused);
+ void transportConnect();
// User related
// maybe we should move it to something like UserManager
More information about the Commits
mailing list