Commit Graph

4955 Commits

Author SHA1 Message Date
Nick Martin
76808dfce2 Remove trailing whitespace. 2013-12-03 03:57:28 -08:00
Nick Martin
1c3877eeb6 Rename establishConnection to be more test-y. Also comment on inappropriate placement. 2013-12-03 03:49:34 -08:00
Nick Martin
c99b0f4475 Move StubStream from test-helpers to livedata. It is only used in livedata tests. 2013-12-03 03:29:29 -08:00
Nick Martin
50870590e2 Make test more robust to other tests leaving things in a bad state. 2013-12-03 03:13:13 -08:00
Nick Martin
a899d2c54d Remove email stubbing code that wasn’t safe for running multiple times on the server. 2013-12-03 02:48:41 -08:00
Nick Martin
09521e9b0c Rework tests that didn’t work when multiple clients run at once. release/pr-1611-3 2013-12-02 23:23:08 -08:00
Andrew Wilcox
7d9f60b07b Remove sessionData.
Add tests to check that account data is cleaned up after a session
closes.

Make `establishConnection` available to account tests.

Remove code duplication between `poll` (now called `simplePoll`) and
the async_multi `pollUntil`.
release/pr-1611-2
2013-11-27 20:01:31 -08:00
Andrew Wilcox
1f3b7cb132 Simplify callers of bindEnvironment by using the new string argument,
when the error callback only needs to print the exception.

Replace unsafe references to `err.stack` with
`err && err.stack || err`.  This avoids throwing a secondary exception
if the original exception in `err` isn't an object (`throw(null)` and
`throw(undefined)` are legal in JavaScript), and also displays the
error object if the stack trace wasn't included.
2013-11-27 20:01:31 -08:00
Andrew Wilcox
c713a664c7 Add a "this.session" entry for methods in the docs.
Pull out the session object into its own documentation section.
2013-11-27 20:01:31 -08:00
Andrew Wilcox
76ae509760 Also make the session available in publish functions. 2013-11-27 20:01:30 -08:00
Andrew Wilcox
bcac2bd11e In the docs, refer to the public object as a "session" instead of a
"session handle".
2013-11-27 20:01:30 -08:00
Andrew Wilcox
f6a5b7734f Fix session handle tests so that multiple copies of the test can run
at the same time.
2013-11-27 20:01:30 -08:00
Andrew Wilcox
5496a4c514 Mention that session id's are globally unique. 2013-11-27 20:01:30 -08:00
Andrew Wilcox
f8a1641517 Check that the connection hasn't been closed already before calling
the onConnection callback.
2013-11-27 20:01:30 -08:00
Andrew Wilcox
33d572a0c2 Documentation update.
Document `Meteor.onConnection` instead of `Meteor.server.onConnection`.

Condense sections about when there is a session reconnect into a
single {{note}}.

Document the `stop` handle returned by `onConnect`.

Document `this.session` in Meteor.methods section.
2013-11-27 20:01:30 -08:00
Andrew Wilcox
0672d20d89 Alias Meteor.server.onConnection to Meteor.onConnection 2013-11-27 20:01:30 -08:00
Andrew Wilcox
17674196c8 Include the session handle in a method invocation instead of just the
session id.

Make _sessionData available in a nested method invocation on the
server.
2013-11-27 20:01:30 -08:00
Andrew Wilcox
1034e5c8a1 Meteor.server.onConnection documentation. 2013-11-27 20:01:30 -08:00
Andrew Wilcox
d3234aa973 Run nodejs stream client callbacks in a fiber.
Poll instead of using Deps.autorun in server test.

When polling the client connection, tests don't have a chance to
disconnect before the stream client automatically reconnects, so add
an option to disable retries for testing.

Callers of `Meteor.bindEnvironment` often have the `onException`
argument print the exception stack trace.  To allow for less code
duplication, let the argument be a string providing the context
(e.g. "connection closed callback"), and then on an exception print
the context and the exception stack trace.
2013-11-27 20:01:30 -08:00
Andrew Wilcox
b2bb2c0dab Space out code for readability. 2013-11-27 20:01:30 -08:00
Andrew Wilcox
f80e7b56d4 Closing a session should be idempotent. 2013-11-27 20:01:29 -08:00
Andrew Wilcox
10ddcdd1e7 Move login token code into the "RECONNECT TOKENS" section. 2013-11-27 20:01:29 -08:00
Andrew Wilcox
42f0eef9da Underscore internal _getLoginToken and _setLoginToken.
`closeSessionsForTokens` doesn't need to clone `sessionsByLoginToken`
because `onClose` callbacks are deferred.

Simplify `closeTokensForUser` by using `_.pluck`.
2013-11-27 20:01:29 -08:00
Andrew Wilcox
02c4ff36df Wrap calling session close callback in Meteor.defer, so that a bunch
of connections can be closed without waiting for the close callbacks
on one connection to return before closing the other connections.

Underscore internal Session field `_closeCallbacks`.

Update comment to explain the cause of the problem requiring the use
of `Meteor.bindEnvironment` with Meteor's public API.
2013-11-27 20:01:29 -08:00
Andrew Wilcox
d888cab5e6 Remove remaining references to login token from livedata. 2013-11-27 20:01:29 -08:00
Andrew Wilcox
04b39b0d30 Implement Meteor.server.onConnection and SessionHandle. 2013-11-27 20:01:29 -08:00
Naomi Seyfer
e58156bd58 Handle long-polling sockets when we are shutting down the server with SIGHUP better 2013-11-27 15:28:28 -08:00
karayu
7372c4cd05 added meta description 2013-11-26 15:34:03 -08:00
Nick Martin
db59ab13c1 wait for server to be running instead of naive sleep. 2013-11-26 15:05:18 -08:00
David Glasser
b2b5e323eb set x-forwarded-* headers in 'meteor run'
This was a regression in 0.6.6 when we upgraded to a new unreleased
version of http-proxy which now requires an explicit option to set them.
See #1624.
2013-11-25 17:16:57 -08:00
Nick Martin
4a8bbce814 Oops, missed one. Add deps package to autoupdate dependencies. 2013-11-21 16:52:23 -08:00
Nick Martin
ed5971b08e Merge branch 'autoupdate-review-from-glasser' into devel 2013-11-21 16:42:47 -08:00
Nick Martin
f25b733bc6 Change AutoUpdate symbol name to be one word not two.
perl -pi -e 's/AutoUpdate/Autoupdate/g' **/*.{js,md}
perl -pi -e 's/autoUpdate/autoupdate/g' **/*.{js,md}
2013-11-21 16:34:07 -08:00
Nick Martin
5803dfbf2f Comments and safety belts from glasser's review. 2013-11-21 16:31:49 -08:00
Emily Stark
d564ab4b99 Fix SeededRandom's use of Random's alea.
Thanks glasser
2013-11-21 10:14:03 -08:00
Matt DeBergalis
8531977bc2 point to Contributing-to-Meteor wiki page 2013-11-20 16:06:19 -08:00
Nick Martin
f4a41a1726 Also include path of file in hash computation.
Followup to 72d3e08067. Without this, the hash wouldn't change and the client
wouldn't reload if a file was renamed in a way that didn't change the order
of files (eg, preserving its name in alphabetical order).

This didn't used to be a problem, as the hash computation was only used in
appcached, which included the file path already and would change if the
file was renamed.
2013-11-19 11:31:25 -08:00
Nick Martin
72d3e08067 Merge branch 'pr/1583' into devel 2013-11-19 02:26:36 -08:00
Nick Martin
32000d4c5e Comments. 2013-11-19 02:20:47 -08:00
Nick Martin
4951520d55 Add history for autoupdate change. 2013-11-19 02:16:48 -08:00
Andrew Wilcox
3245f0d9d6 Comment on hack encoding knowledge of autoupdate in livedata. 2013-11-19 01:34:54 -08:00
Andrew Wilcox
22f9183c6b use Deps.autorun, remove unused crypto 2013-11-19 01:34:54 -08:00
Andrew Wilcox
005e4a2e85 livedata doesn't need to use localstorage because it's now using
reload migration instead.
2013-11-19 01:34:54 -08:00
Andrew Wilcox
a2c4a78743 Have using test-in-browser cause autoupdate to reload on server changes,
which is convenient when running unit tests in the browser.
2013-11-19 01:34:54 -08:00
Andrew Wilcox
15f5ca3d7e Have the client send the "connect" message on stream open
instead of waiting for the welcome message.
2013-11-19 01:34:54 -08:00
Andrew Wilcox
8d3929e450 Fix typo. 2013-11-19 01:34:54 -08:00
Andrew Wilcox
8c0e02635b Add an overview of autoupdate and the code push process. 2013-11-19 01:34:54 -08:00
Andrew Wilcox
78b9a47fcb Fix livedata tests. 2013-11-19 01:34:54 -08:00
Andrew Wilcox
6239d388ef Reuse stream reconnect exponential backoff code for DDP version
negotiation failure retries.
2013-11-19 01:34:53 -08:00
Andrew Wilcox
456e6916be Use reload migration API instead of localstorage.
Remove the unused `serverRequestedVersion` argument to
`onDDPVersionNegotiationFailure`.

And let's call the remaining argument `description` instead of `error`
since it isn't an Error object.
2013-11-19 01:34:53 -08:00