Commit graph

71 commits

Author SHA1 Message Date
Joey Hess
207ac67aaa avoid needing a build-dep on hxt for Data.AssocList 2014-01-14 16:42:10 -04:00
Joey Hess
d07f2d7865 Fix a long-standing bug that could cause the wrong index file to be used when committing to the git-annex branch, if GIT_INDEX_FILE is set in the environment. This typically resulted in git-annex branch log files being committed to the master branch and later showing up in the work tree. (These log files can be safely removed.) 2014-01-14 15:36:33 -04:00
Joey Hess
780efc775c When an XMPP server has SRV records, try them, but don't then fall back to the regular host if they all fail.
gmail.com has some XMPP SRV records, but does not itself respond to XMPP
traffic, although it does accept connections on port 5222. So if a user
entered the wrong password, it would try all the SRVs and fall back to
trying gmail, and hang at that point.

This seems the right thing to do, not just a workaround.
2013-07-20 21:18:55 -04:00
Joey Hess
b6d857da08 fix build 2013-07-08 12:53:08 -04:00
Joey Hess
96ded21ae5 fix display of expected sequence number 2013-07-08 12:31:32 -04:00
Joey Hess
d8d46c3ba3 when xmpp connection fails, show the host(s) it tried to connect to 2013-05-27 14:36:20 -04:00
Joey Hess
c15a0b796e 3 more fd leaks 2013-05-26 21:27:44 -04:00
Joey Hess
c092b4fc16 XMPP: Fix a file descriptor leak. 2013-05-26 20:49:16 -04:00
Joey Hess
e2b67e0bc4 add two long-running XMPP push threads, no more inversion of control
I hope this will be easier to reason about, and less buggy. It was
certianly easier to write!

An immediate benefit is that with a traversable queue of push requests to
select from, the threads can be a lot fairer about choosing which client to
service next.
2013-05-22 15:13:31 -04:00
Joey Hess
6e04194e84 perhaps this fixes the stall tbd 2013-05-21 21:40:37 -04:00
Joey Hess
08c03b2af3 XMPP: Avoid redundant and unncessary pushes. Note that this breaks compatibility with previous versions of git-annex, which will refuse to accept any XMPP pushes from this version. 2013-05-21 18:24:29 -04:00
Joey Hess
9efde46cdd per-client inboxes for push messages
This will avoid losing any messages received from 1 client when a push
involving another client is running.

Additionally, the handling of push initiation is improved,
it's no longer allowed to run multiples of the same type of push to
the same client.

Still stalls sometimes :(
2013-05-21 11:08:08 -04:00
Joey Hess
14d96b8e06 XMPP: Be better at responding to CanPush messages when busy with something else.
Observed: With 2 xmpp clients, one would sometimes stop responding
to CanPush messages. Often it was in the middle of a receive-pack
of its own (or was waiting for a failed one to time out).

Now these are always immediately responded to, which is fine; the point
of CanPush is to find out if there's another client out there that's
interested in our push.

Also, in queueNetPushMessage, queue push initiation messages when
we're already running the side of the push they would initiate.
Before, these messages were sent into the netMessagesPush channel,
which was wrong. The xmpp send-pack and receive-pack code discarded
such messages.

This still doesn't make XMPP push 100% robust. In testing, I am seeing
it sometimes try to run two send-packs, or two receive-packs at once
to the same client (probably because the client sent two requests).

Also, I'm seeing rather a lot of cases where it stalls out until it
runs into the 120 second timeout and cancels a push.

And finally, there seems to be a bug in runPush. I have logs that
show it running its setup action, but never its cleanup action.
How is this possible given its use of E.bracket? Either some exception
is finding its way through, or the action somehow stalls forever.
When this happens, one of the 2 clients stops syncing.
2013-05-21 00:59:38 -04:00
Joey Hess
230aed671f XMPP: Ignore duplicate messages received when pushing. 2013-05-20 21:58:59 -04:00
Joey Hess
18bdff3fae clean up from windows porting 2013-05-11 18:23:41 -04:00
Joey Hess
7c2a90b0e8 fix for Android 2013-05-09 15:23:40 -04:00
Joey Hess
749c197947 fix use of wrong shebang when android is installing git-annex-shell wrapper on server 2013-05-06 15:58:13 -04:00
Joey Hess
df88c51334 add uuid to all xmpp messages
(Except for the actual streaming of receive-pack through XMPP, which
can only run once we've gotten an appropriate uuid in a push initiation
message.)

Pushes are now only initiated when the initiation message comes from a
known uuid. This allows multiple distinct repositories to use the same xmpp
address.

Note: This probably breaks initial push after xmpp pairing, because at that
point we may not know about the paired uuid, and so reject the push from
it. It won't break in simple cases, because the annex-uuid of the remote
is checked. However, when there are multiple clients behind a single xmpp
address, only uuid of the first is recorded in annex-uuid, and so any
pushes from the others will be rejected (unless the first remote pushes their
uuids to us beforehand.
2013-04-30 13:22:55 -04:00
Joey Hess
2c42e70f6c rename module 2013-04-23 11:38:52 -04:00
Joey Hess
8a2d1988d3 expose Control.Monad.join
I think I've been looking for that function for some time.
Ie, I remember wanting to collapse Just Nothing to Nothing.
2013-04-22 20:24:53 -04:00
Joey Hess
271a919d14 assistant: Added sequence numbers to XMPP git push packets. (Not yet used.)
For backwards compatability, "" is treated as "0" sequence number.

--debug will show xmpp sequence numbers now, but they are not otherwise
used.
2013-04-10 18:39:56 -04:00
Joey Hess
1f1cddbaa7 syncNewRemote is not only used for new remotes; rename to syncRemote 2013-04-08 15:43:43 -04:00
Joey Hess
3ef6b6a200 fix build with xmpp and w/o webapp 2013-03-24 18:55:19 -04:00
Joey Hess
449520a573 add globallyAvailable to remotes 2013-03-15 19:16:13 -04:00
Joey Hess
77c82de4ea webapp: Display an alert when there are XMPP remotes, and a cloud transfer repository needs to be configured. 2013-03-15 17:52:41 -04:00
Joey Hess
ade57af9e5 add alerts while performing xmpp git push/pull 2013-03-07 02:38:57 -04:00
Joey Hess
57b601e384 assistant: Fix syncing after XMPP pairing.
A missing uuid broke this, and also caused a UI glitch in the webapp's
remote list.
2013-03-06 22:18:44 -04:00
Joey Hess
cbb6e1fae4 tag xmpp pushes with jid
This fixes the issue mentioned in the last commit.

Turns out just collecting UUID of clients behind a XMPP remote is
insufficient (although I should probably still do it for other reasons),
because a single remote repo might be connected via both XMPP and local
pairing. So a way is needed to know when a push was received from any
client using a given XMPP remote over XMPP, as opposed to via ssh.
2013-03-06 16:29:19 -04:00
Joey Hess
c23ea9e311 assistant: Get back in sync with XMPP remotes after network reconnection, and on startup.
Make manualPull send push requests over XMPP.

When reconnecting with remotes, those that are XMPP remotes cannot
immediately be pulled from and scanned, so instead maintain a set of
(probably) desynced remotes, and put XMPP remotes on it. (This set could be
used in other ways later, if we can detect we're out of sync with other
types of remotes.)

The merger handles detecting when a XMPP push is received from a desynced
remote, and triggers a scan then, if they have in fact diverged.

This has one known bug: A single XMPP remote can have multiple clients
behind it. When this happens, only the UUID of one client is recorded
as the UUID of the XMPP remote. Pushes from the other XMPP clients will not
trigger a scan. If the client whose UUID is expected responds to the push
request, it'll work, but when that client is offline, we're SOL.
2013-03-06 15:09:31 -04:00
Joey Hess
f40180f033 deal with Android's nonstandard shell location
This is so gratutious and pointless. It's a shame that everything we
learned about Unix portability and the importance of standards has been
thrown out the window by these guys.
2013-02-13 14:30:04 -04:00
Joey Hess
e250f6f11f factor out Creds 2012-11-14 19:32:27 -04:00
Joey Hess
98d45cd383 use System.Timeout
I'd forgotten this existed!
2012-11-14 11:53:23 -04:00
Joey Hess
e10137b4da upper-case first char of buddy name 2012-11-12 13:27:30 -04:00
Joey Hess
5e44ab177c don't try to transfer data to/from XMPP remotes
Partition syncRemotes into ones needing git sync (ie, non-special remotes),
and ones needing data sync (ie, non-XMPP remotes).
2012-11-11 16:23:16 -04:00
Joey Hess
217eeede43 allow both one push and one receive-pack to run at the same time
Noticed that when pairing, sometimes both sides start to push, and the other
side sends a PushRequest, and the two deadlock, neither doing anything.
(Timeout eventually breaks this.) So, let both run at the same time.
2012-11-11 15:42:03 -04:00
Joey Hess
b44e8bb4a5 add 120 second timeout when waiting for XMPP packets 2012-11-11 13:38:28 -04:00
Joey Hess
f3bbe075f2 fix creation of creds directory for xmpp 2012-11-10 20:48:45 -04:00
Joey Hess
fd22734392 show when a buddy is already paired 2012-11-10 16:36:21 -04:00
Joey Hess
957e742dfc full-on git-annex assistant syncing now works over XMPP!
I decided to use the fallback push mode from the beginning for XMPP, since
while it uses some ugly branches, it avoids the possibility of a normal
push failing, and needing to pull and re-push. Due to the overhead of XMPP,
and the difficulty of building such a chain of actions due to the async
implementation, this seemed reasonable.

It seems to work great!
2012-11-10 14:38:50 -04:00
Joey Hess
81953c2131 separate data type for push stages
This improves type safety.
2012-11-10 12:18:00 -04:00
Joey Hess
f57c2ef99e refactor 2012-11-10 00:24:26 -04:00
Joey Hess
0f8bbcc8fd refactor 2012-11-10 00:15:00 -04:00
Joey Hess
5fce2c013d refactor 2012-11-10 00:09:03 -04:00
Joey Hess
341d09adc2 fix exit code propigation 2012-11-10 00:02:55 -04:00
Joey Hess
ee0958e044 refactor 2012-11-09 23:52:51 -04:00
Joey Hess
c00ecfbb83 ensure handles get closed 2012-11-09 23:27:07 -04:00
Joey Hess
3f2467f253 increase chunk size
XMPP has no defined message size limits, but some servers will have ad-hoc
limits. However, 4k seems safe, even after the additional bloat of base64.
That should not exceed 8k.
2012-11-09 23:21:51 -04:00
Joey Hess
4a5e758a5a refactor 2012-11-09 23:17:47 -04:00
Joey Hess
6174c748af refactor 2012-11-09 23:12:54 -04:00
Joey Hess
62fa648455 xmpp git push is working!
Various final bug fixes, and tweaks that got it working.

Currently pushes a hardcoded ref, which needs to be fixed, etc.
2012-11-09 17:40:59 -04:00