Commit Graph

395 Commits

Author SHA1 Message Date
akwizgran
99caec9448 Refactoring.
Unidirectional transports and connections are now called
simplex rather than batch. Bidirectional transports and connections
are now called duplex rather than stream.
2012-01-11 17:00:47 +00:00
akwizgran
1499e061c1 Callback should not be null. 2012-01-11 16:17:14 +00:00
akwizgran
3e61adb623 Avoid making alien calls with locks held. 2011-12-10 19:21:00 +00:00
akwizgran
cbc5fd1bb4 If the reader detects a clean close, let the writer finish and close
cleanly.
2011-12-10 16:53:04 +00:00
akwizgran
f2de23854e Added BoundedExecutor and documented executor policies. 2011-12-10 00:59:29 +00:00
akwizgran
e47d4990c3 Fixed Bluetooth shutdown issues. 2011-12-09 23:01:32 +00:00
akwizgran
5ba5887565 Debugging Bluetooth threading issues. 2011-12-09 22:20:32 +00:00
akwizgran
4671b50b37 Close the invitation socket early if a connection is received. 2011-12-09 21:36:53 +00:00
akwizgran
8af7e72943 Cancel outstanding tasks and shut down the executor. 2011-12-09 21:13:53 +00:00
akwizgran
cd068e89c0 Converted plugin executor to ScheduledExecutorService.
No Thread.sleep() till Brooklyn.
2011-12-09 21:02:36 +00:00
akwizgran
2014235b86 Log the server socket details to make it easier to run manual tests
between two machines.
2011-12-09 20:41:05 +00:00
akwizgran
f9f41acde9 Added a connection registry to avoid creating redundant connections. 2011-12-09 17:34:58 +00:00
akwizgran
9abe920edb Plugin code cleanup. 2011-12-09 00:08:15 +00:00
akwizgran
2494ff1a1e Let the plugin determine whether to flush the output stream after each
packet.
2011-12-08 22:13:35 +00:00
akwizgran
844ae8f0a7 Plugins may dispose of resources differently depending on whether a
connection was recognised.
2011-12-08 18:56:53 +00:00
akwizgran
6962814eec Log the exception class when logging exceptions. 2011-12-08 17:28:05 +00:00
akwizgran
9f0b865ba8 Plugins should use the executor rather than creating threads. 2011-12-08 16:57:24 +00:00
akwizgran
c6b6c20205 Bind instances rather than singletons. 2011-12-08 16:37:09 +00:00
akwizgran
e3242ebb06 Read the tag on a connection recogniser thread, don't block the
plugin.
2011-12-08 16:33:48 +00:00
akwizgran
6e080bb35d Dedicated executors for plugins and the connection recogniser. 2011-12-08 16:11:24 +00:00
akwizgran
caf5f34828 Refactoring: moved high-level connection classes to protocol package. 2011-12-08 15:06:50 +00:00
akwizgran
1886609bef Removed frame padding code (soon to be obsolete). 2011-12-08 14:35:52 +00:00
akwizgran
d9fc8d18d1 Better handling of InterruptedExceptions. 2011-12-08 13:55:19 +00:00
akwizgran
c1ab21ba2f Don't generate acks faster than the IO thread can write them. 2011-12-08 12:56:00 +00:00
akwizgran
ae87100c8f Moved batch ID calculation off the IO thread. 2011-12-08 12:51:34 +00:00
akwizgran
d91f96b5e2 Close the writer when the reader closes; only dispose of the
connection once.
2011-12-08 00:06:05 +00:00
akwizgran
b95753bb24 Use a BlockingQueue to simplify synchronisation. 2011-12-07 23:38:43 +00:00
akwizgran
c728377ae1 Removed the DB listener when the connection is closed. 2011-12-07 21:37:13 +00:00
akwizgran
e2cb1027af Moved message verification into a separate thread pool. 2011-12-07 21:33:14 +00:00
akwizgran
22dfe947fa Minor code cleanup. 2011-12-07 21:02:18 +00:00
akwizgran
2020f60ebf Rewrote StreamConnection to decouple the database from IO.
Runnables encapsulating database or IO tasks are passed to the
relevant threads. The IO thread's task queue is unbounded to avoid
deadlock, but its growth is indirectly limited by the progress of
database tasks.
2011-12-07 20:52:04 +00:00
akwizgran
5099979b9d Encapsulate the database thread pool and task queue. 2011-12-07 14:34:16 +00:00
akwizgran
a9a81f0870 Removed unnecessary calls to MessageDigest.reset(). 2011-12-07 13:37:13 +00:00
akwizgran
1c41ffa7af Don't accept empty acks, batches or offers. 2011-12-07 13:32:17 +00:00
akwizgran
495baf8c70 BATCH_ID and MESSAGE_ID don't need to be structs. 2011-12-07 00:38:14 +00:00
akwizgran
b7c3224618 Decouple the database from IO.
This will enable asynchronous access to the database for IO threads.
2011-12-07 00:23:35 +00:00
akwizgran
45a51b4926 ExceptionHandler interface. 2011-12-06 10:58:26 +00:00
akwizgran
00df158ad6 Ensure semaphore is released if an exception is thrown. 2011-12-06 00:03:05 +00:00
akwizgran
f474ed229d Limit the number of waiting database writes to avoid running out of
memory.
2011-12-05 23:16:27 +00:00
akwizgran
e24a3218ca Moved message verification and DB writes off the IO thread. 2011-12-05 22:52:00 +00:00
akwizgran
ab722f9371 Minor refactoring. 2011-12-02 16:32:50 +00:00
akwizgran
6752781835 Removed redundant padding check. 2011-12-02 16:24:00 +00:00
akwizgran
726799d848 Check that padding is set to zero. 2011-12-02 16:21:20 +00:00
akwizgran
4ab5dfcac0 Allow empty frames. 2011-12-02 16:10:44 +00:00
akwizgran
c8338f9866 Connection readers and writers don't need the connection context. 2011-12-02 14:23:45 +00:00
akwizgran
51d58fadad Include the frame number in the header.
This ensures the frame number is covered by the MAC, cleanly
separating encryption from authentication (previously we depended on
the encryption layer to garble frames if they were reordered).
2011-12-02 13:37:44 +00:00
akwizgran
14d5e6fe64 Replaced encrypted IVs with pseudo-random tags. 2011-12-02 12:57:39 +00:00
akwizgran
f3fdd85996 Renamed "encrypted IVs" as "tags" (actual crypto changes to follow). 2011-12-02 12:02:55 +00:00
akwizgran
f7360cddde Renamed "user-defined types" as "structs" in the serialisation format. 2011-12-02 11:36:45 +00:00
akwizgran
2fb797a197 Throw an exception rather than blocking if a transaction is started
after the database has closed.
2011-12-01 20:05:45 +00:00