[962] in BarnOwl Developers
[D-O-H] r948 - in branches/barnowl_select/owl: . perl/modules/Jabber/lib/BarnOwl/Module perl/modules/Jabber/lib/BarnOwl/Module/Jabber
daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:11:36 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Mon, 18 Feb 2008 17:38:32 -0500 (EST)
Author: asedeno
Date: 2008-02-18 17:38:32 -0500 (Mon, 18 Feb 2008)
New Revision: 948
Modified:
branches/barnowl_select/owl/functions.c
branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm
branches/barnowl_select/owl/select.c
Log:
functions.c:
* removing the redisplay call from owl_function_lastmsg_noredisplay()
select.c:
* Watch AIM sockets for writing as well. This speeds up AIM connections significantly.
Jabber.pm
* keep a copy of the fd around for later.
* Process() on mainloop for keep-alives
Jabber/ConnectionManager.pm
* Use the stored fd to drop the dispatch for a connection.
Jabber/Connection.pm
* Use the GetSock() abstraction since we have it.
* Call the right do_logout when we have trouble.
Modified: branches/barnowl_select/owl/functions.c
===================================================================
--- branches/barnowl_select/owl/functions.c 2008-02-18 21:45:22 UTC (rev 947)
+++ branches/barnowl_select/owl/functions.c 2008-02-18 22:38:32 UTC (rev 948)
@@ -797,7 +797,7 @@
owl_global_set_topmsg(&g, curmsg+1);
owl_global_set_curmsg(&g, curmsg+1);
}
- owl_mainwin_redisplay(owl_global_get_mainwin(&g));
+ /* owl_mainwin_redisplay(owl_global_get_mainwin(&g)); */
owl_global_set_direction_downwards(&g);
}
Modified: branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
===================================================================
--- branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm 2008-02-18 21:45:22 UTC (rev 947)
+++ branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm 2008-02-18 22:38:32 UTC (rev 948)
@@ -129,7 +129,7 @@
sub getSocket {
my $self = shift;
my $sid = getStreamID($self);
- return $self->{STREAM}->{SIDS}->{$sid}->{sock} || -1;
+ return $self->{STREAM}->GetSock($sid) || -1;
}
=head2 OwlProcess
@@ -144,7 +144,7 @@
if ( !defined($status) ) {
my $jid = $self->{SESSION}->{FULLJID};
BarnOwl::error("Jabber account $jid disconnected!");
- do_logout($jid);
+ BarnOwl::Module::Jabber::do_logout($jid);
}
}
Modified: branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm
===================================================================
--- branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm 2008-02-18 21:45:22 UTC (rev 947)
+++ branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm 2008-02-18 22:38:32 UTC (rev 948)
@@ -36,7 +36,7 @@
my $jidStr = shift;
return 0 unless exists $self->{$jidStr};
- BarnOwl::remove_dispatch($self->{$jidStr}->{Client}->getSocket()->fileno());
+ BarnOwl::remove_dispatch($self->{$jidStr}->{Client}->{fileno}) if $self->{$jidStr}->{Client}->{fileno};
$self->{$jidStr}->{Client}->Disconnect()
if $self->{$jidStr}->{Client};
delete $self->{$jidStr};
Modified: branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2008-02-18 21:45:22 UTC (rev 947)
+++ branches/barnowl_select/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm 2008-02-18 22:38:32 UTC (rev 948)
@@ -115,10 +115,17 @@
$conn->removeConnection($jid);
BarnOwl::error("Connection for $jid undefined -- error in reload?");
}
+ # We keep this in the mainloop hook for keep-alives
+ my $status = $client->Process(0);
+ if ( !defined($status) ) {
+ BarnOwl::error("Jabber account $jid disconnected!");
+ do_logout($jid);
+ }
if ($::shutdown) {
do_logout($jid);
next;
}
+
if ($vars{status_changed}) {
my $p = new Net::Jabber::Presence;
$p->SetShow($vars{show}) if $vars{show};
@@ -382,7 +389,9 @@
queue_admin_msg("Connected to jabber as $fullJid");
# The remove_dispatch() method is called from the
# ConnectionManager's removeConnection() method.
- BarnOwl::add_dispatch($client->getSocket()->fileno(), sub { $client->OwlProcess() });
+ $client->{fileno} = $client->getSocket()->fileno();
+ #queue_admin_msg("Connected to jabber as $fullJid ($client->{fileno})");
+ BarnOwl::add_dispatch($client->{fileno}, sub { $client->OwlProcess() });
}
}
}
Modified: branches/barnowl_select/owl/select.c
===================================================================
--- branches/barnowl_select/owl/select.c 2008-02-18 21:45:22 UTC (rev 947)
+++ branches/barnowl_select/owl/select.c 2008-02-18 22:38:32 UTC (rev 948)
@@ -104,7 +104,7 @@
return 1;
}
-int owl_select_dispatch_prepare_fd_sets(fd_set *r, fd_set *e)
+int owl_select_dispatch_prepare_fd_sets(fd_set *r, fd_set *w, fd_set *e)
{
int i, len, max_fd;
owl_dispatch *d;
@@ -118,6 +118,7 @@
for(i = 0; i < len; i++) {
d = (owl_dispatch*)owl_list_get_element(dl, i);
FD_SET(d->fd, r);
+ FD_SET(d->fd, w);
FD_SET(d->fd, e);
if (max_fd < d->fd) max_fd = d->fd;
}
@@ -185,7 +186,7 @@
timeout.tv_sec = 1;
timeout.tv_usec = 0;
- max_fd = owl_select_dispatch_prepare_fd_sets(&r, &e);
+ max_fd = owl_select_dispatch_prepare_fd_sets(&r, &w, &e);
/* AIM HACK:
*