Commit Graph

5122 Commits

Author SHA1 Message Date
Andrew Wilcox
e253ecd46a Another session -> connection renaming. 2013-12-05 13:14:10 -08:00
Nick Martin
bd978adcbd History note for session hooks. 2013-12-05 13:14:10 -08:00
Nick Martin
76c78645ff Rename this.session to this.connection. 2013-12-05 13:14:10 -08:00
Nick Martin
a3bbb6dfa1 Update and tweak docs for new name. 2013-12-05 13:14:10 -08:00
Nick Martin
91ad6c0189 Remove trailing whitespace. 2013-12-05 13:14:10 -08:00
Nick Martin
f328079780 Rename establishConnection to be more test-y. Also comment on inappropriate placement. 2013-12-05 13:14:10 -08:00
Nick Martin
9181de2d1e Move StubStream from test-helpers to livedata. It is only used in livedata tests. 2013-12-05 13:14:10 -08:00
Nick Martin
3229b36578 Make test more robust to other tests leaving things in a bad state. 2013-12-05 13:14:09 -08:00
Nick Martin
d1cb3742f3 Remove email stubbing code that wasn’t safe for running multiple times on the server. 2013-12-05 13:14:09 -08:00
Nick Martin
1bd2976206 Rework tests that didn’t work when multiple clients run at once. 2013-12-05 13:14:09 -08:00
Andrew Wilcox
46afaec215 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`.
2013-12-05 13:14:09 -08:00
Andrew Wilcox
614d91b6b0 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-12-05 13:14:06 -08:00
Andrew Wilcox
62fe9c62e5 Add a "this.session" entry for methods in the docs.
Pull out the session object into its own documentation section.
2013-12-05 13:11:40 -08:00
Andrew Wilcox
c1d97fde7c Also make the session available in publish functions. 2013-12-05 13:11:40 -08:00
Andrew Wilcox
26e9fad096 In the docs, refer to the public object as a "session" instead of a
"session handle".
2013-12-05 13:11:40 -08:00
Andrew Wilcox
67a589be8b Fix session handle tests so that multiple copies of the test can run
at the same time.
2013-12-05 13:11:40 -08:00
Andrew Wilcox
819019f08f Mention that session id's are globally unique. 2013-12-05 13:11:40 -08:00
Andrew Wilcox
72eded7e2f Check that the connection hasn't been closed already before calling
the onConnection callback.
2013-12-05 13:11:39 -08:00
Andrew Wilcox
badb6e9d30 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-12-05 13:11:39 -08:00
Andrew Wilcox
6462e2dae9 Alias Meteor.server.onConnection to Meteor.onConnection 2013-12-05 13:11:39 -08:00
Andrew Wilcox
41f44b1ad6 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-12-05 13:11:39 -08:00
Andrew Wilcox
8644363f1a Meteor.server.onConnection documentation. 2013-12-05 13:11:39 -08:00
Andrew Wilcox
ccaeef516f 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-12-05 13:11:39 -08:00
Andrew Wilcox
e7ef2a2406 Space out code for readability. 2013-12-05 13:11:39 -08:00
Andrew Wilcox
2f1ddc0e81 Closing a session should be idempotent. 2013-12-05 13:11:39 -08:00
Andrew Wilcox
92df70cb48 Move login token code into the "RECONNECT TOKENS" section. 2013-12-05 13:11:39 -08:00
Andrew Wilcox
0e4ba1580d Underscore internal _getLoginToken and _setLoginToken.
`closeSessionsForTokens` doesn't need to clone `sessionsByLoginToken`
because `onClose` callbacks are deferred.

Simplify `closeTokensForUser` by using `_.pluck`.
2013-12-05 13:11:38 -08:00
Andrew Wilcox
2ae1ea495f 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-12-05 13:11:38 -08:00
Andrew Wilcox
e7f28645cd Remove remaining references to login token from livedata. 2013-12-05 13:11:38 -08:00
Andrew Wilcox
e63177346a Implement Meteor.server.onConnection and SessionHandle. 2013-12-05 13:11:38 -08:00
David Glasser
bc8d745d46 Merge branch 'oplog' into devel 2013-12-05 02:03:47 -08:00
David Glasser
276b4c0bb7 Merge branch 'devel' into oplog 2013-12-05 02:01:44 -08:00
Emily Stark
43648de7e5 Use array of args when applying reconnect 2013-12-04 22:05:28 -08:00
Emily Stark
a3abdfe8f9 Get rid of last vestiges of options for makeElectorTries 2013-12-04 21:27:06 -08:00
David Glasser
593d980ba6 implement 'test-packages --disable-oplog' 2013-12-04 12:54:27 -08:00
David Glasser
880cf37a3f New disable-oplog package 2013-12-04 12:46:47 -08:00
David Glasser
38e83bb139 implement cursor.find(s, {_disableOplog: true}) 2013-12-04 12:40:09 -08:00
David Glasser
643fbad4dc Move object check into _checkSupportedProjection
also ensure 'fields' is not an array
2013-12-04 11:56:21 -08:00
Emily Stark
18704dccaa Note in the docs that BrowserPolicy can only be used in server code 2013-12-04 10:40:49 -08:00
Slava Kim
534efb51e4 _checkSupportedProjection instead of _supportedProjection 2013-12-03 18:16:24 -08:00
Slava Kim
1b27b7cf14 Tests for an empty projection 2013-12-03 17:30:16 -08:00
Slava Kim
eeea007645 Move checks around 2013-12-03 17:28:56 -08:00
Slava Kim
fb2886d88a Don't use oplog tailing for queries with unsupported fields projection 2013-12-03 15:27:47 -08:00
David Glasser
52ff2df323 Merge branch 'devel' into oplog
Conflicts:
	packages/application-configuration/config.js
	packages/minimongo/minimongo.js
2013-12-03 15:01:37 -08:00
Slava Kim
001d2811d2 Throw on unsupported fields projection 2013-12-03 14:59:22 -08:00
David Glasser
6582a88608 Fix 0.6.6 regression in setting MAIL_URL
Also:
- ensure that AppConfig callbacks are always called at least once
- don't start a new AppConfig Fiber every time you call Email.send

Fixes #1649.
2013-12-03 14:49:38 -08:00
Slava Kim
5314ffedd3 Properly handle projections where '_id' is the only rule.
+ Tests. Fixes #1651

Conflicts:
	packages/minimongo/minimongo.js
2013-12-03 13:51:35 -08:00
Slava Kim
df95f1e914 Properly handle projections where '_id' is the only rule.
+ Tests. Fixes #1651
2013-12-03 13:39:50 -08:00
David Glasser
1189a7ae42 make connection._oplogHandle into a classy object 2013-12-02 19:17:43 -08:00
David Glasser
9abfffbb66 add "_observe_driver" to filenames 2013-12-02 19:17:42 -08:00