82 Commits

Author SHA1 Message Date
PSp..om
71df4f9acd Client will log the exception that causes it to disconnect
just in case the caller has not registered any listeners.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7525 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-25 20:33:59 +00:00
PSp..om
e6c9cbac12 Modified the setAttribute() method to remove the attribute
if the value is null instead of throwin an NPE.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7485 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-11 17:12:01 +00:00
PSp..om
8ed2db29a6 Reworked how client connection teardown happens in the face
of the network connection disappearing or any other random errors
on the channel.  Now errors that cause the connection to drop
will be properly reported as client disconnects... there is also
a new error field on the DisconnectInfo that is filled in in these
cases.
Added an ErrorListener that can be used to more tightly control
how errors are handled for the Client.
Fixed the double event dispatch that occurred during Client
closing.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7451 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-05 05:59:52 +00:00
PSp..om
95315cfd0c Fixing a pretty significant typo.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7450 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-05 05:49:18 +00:00
PSp..om
17221395dc The KernelAdapter now keeps a rolling message buffer
for the endpoints when using a reliable connection.
There is no guarantee that the buffers going out from
a client won't be chopped up by the networking stack
in various ways.  It was always the intent to accumulate
them like this (the client side already does after all)
but it was an oversight.  It's a testament to modern
networking that this hasn't come up in practice yet.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7449 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-05 05:07:28 +00:00
PSp..om
1b837fe7ea Make client-side background threads daemon.
Reduced the amount of logging from invalid UDP messages
received.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7314 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-26 21:53:49 +00:00
PSp..om
2bc6e27200 Proper fix for the bug where JME's quaternion wasn't
being serialized automatically.
When a class is final and in the field of a class that
is registered, it is safe to register it automatically
because the type can be determined reliably on the
other end of the stream.  So now it allows that.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7276 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-20 17:41:15 +00:00
nor..67
1203073bd9 - make SM Serializer only display warning instead of throwing an Exception when the class has not been registered, internally supported classes like jME math primitives were not accepted anymore
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7267 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-20 13:58:26 +00:00
PSp..om
d0a5ce55b9 Moved some exception handling to terminate connections
that throw low level exceptions.  The specific case I
saw for this was "An existing connection was forcibly
closed by the remote host" IOException.  Without this
new handling, SM continually tried to send the connection
its data.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7260 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-18 17:27:11 +00:00
PSp..om
9073820361 Reuse one big buffer per thread and copy the outbound
smaller buffers.  Way faster and way cheaper overall.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7259 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-18 05:56:52 +00:00
PSp..om
85b4eea8d7 Name the executor threads based on something that might
be useful to someone debugging thread dumps. ;)


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7258 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-18 03:48:41 +00:00
PSp..om
7d6d513fa5 Modified the DefaultClient (really its ConnectionAdapters)
to send their outbound data on a background thread.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7257 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-18 03:17:18 +00:00
PSp..om
e298a4357e Modified the toString() for UdpEndpoint to include
the address instead of the socket... since they all share
the same socket anyway and the datagram sockets don't 
have useful toString()s.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7256 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-17 21:14:41 +00:00
PSp..om
5225599ee2 Fixed a case where an exception would kill the kernel
adapter thread.  Also improved the details of the error
logging.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7255 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-17 21:04:09 +00:00
PSp..om
593d9bf35a UDP-based kernel now does its writes on a background
thread.  Most of the time UDP packets go right out
but not always... depending on the network layer it can
take a couple of milliseconds.  And that's alot when
you're blasting packets out to a dozen users 20 times
a second.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7245 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-16 03:51:43 +00:00
PSp..om
1f1c2ac15b Tightened up the DefaultServer connection close code
to make sure that the connection closed change event
only goes out once.
Added some additional logging to the endpoint closings.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7244 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-16 01:54:51 +00:00
PSp..om
189a787d36 Added some warning for some odd state issues that can happen
in real life.
Fixed a subtle bug with the UDP endpoints where they weren't
getting propery closed.  This manifested as the endpoints
still getting broadcasts even after Server no longer knew
about them.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7243 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-16 00:13:25 +00:00
PSp..om
c5ac1c8bfe Modified to throw an exception if the class of the object
being written hasn't been registered yet and does not
have an explicit ID set.  The old way would try to send
it anyway and then it would fail to get received on the
other end.
A setStrictRegistration(false) method can be used to get the
old behavior if needed.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7222 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-09 08:07:25 +00:00
PSp..om
0f1b05b405 Fixed the few uncheck warnings that I could... suppressed
the rest.  Added an UnsupportedOperationException to 
SerializableSerializer so that it doesn't silently fail
to do anything at all.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7219 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-08 02:55:21 +00:00
PSp..om
49f65bd7aa At least fixing the type-check warnings in the code I added.
Serializer is a little harder...


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7218 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-08 02:01:52 +00:00
PSp..om
4deb4d46e7 Improved the exception handling when objects fail
to instantiate.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7217 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-07 22:40:53 +00:00
sha..rd
cbbb261828 * Made sync system deprecated
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7188 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-05 02:28:49 +00:00
PSp..om
041f47157d Modified serializer to throw an exception if it tries
to read from a buffer and doesn't understand what class
it's reading.  Error messages... it's the little things
that matter.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7180 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-04 01:01:17 +00:00
PSp..om
858925182e Added a log INFO message for when messages are dispatched
and no listeners are registered to receive it.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7154 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-01 21:42:13 +00:00
PSp..om
d3364b4622 Fixed an NPE (apparently harmless) for a certain connection
teardown ordering and added some logging just to be sure
the channels are getting closed.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7153 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-01 21:33:13 +00:00
PSp..om
50465e37b3 Fixed a getConnection() bug caused by a silent autoboxing
issue left over from when the long -> int client ID 
conversion was made.  Now connection lookups work again.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7152 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-01 21:23:48 +00:00
PSp..om
37cc6e581d Deprecated registerPackage() and added a log INFO to
log all classes that are registered.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7136 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-28 19:33:41 +00:00
PSp..om
f7f47a13e4 Modified to log and continue when the message/event
dispatch throws exceptions.  This protects the server
from dying just because of a bad listener.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7125 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 07:17:54 +00:00
PSp..om
6465dbd516 Removing an errant println.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7124 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 05:47:29 +00:00
PSp..om
e58ec4b8a0 Added code that will wake up the blocked kernel-caller
if there are events to deal with.  This wasn't a big
deal for connects because there's always an accompanying
message but for disconnects we wouldn't get events until
the next message came through.  Always meant to go back
and fix it and now I have.  Note: this is because our
adapters use a single thread for pulling envelopes off
and for dispatching connection events.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7123 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 05:39:00 +00:00
PSp..om
3fc0d506f4 Added some info logging for connection close events...
we log connect, might as well log disconnect.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7122 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 05:37:06 +00:00
PSp..om
99a21a8c1d This would have saved me soooo much time. Serializer's
single-arg registerClass() method now throws an exception
if the object is not marked Serializable.  Internally,
the package-load stuff uses the new alternate method that
allows safe non-exception throwing registration since it's
hitting it with every class in a package.
Interestingly enough, messages will still get written out 
because of some questionable code in writeClassAndObject()...
but it won't be read as anything but null despite its
40+ bytes of data.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7121 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 05:31:21 +00:00
PSp..om
5012b2d3dd Use an extra byte per final-typed field to handle
the case of nulls.  Note: this is specific to
serialized objects and is therefore not adding
a byte to things like Strings or arrays... those
will have to be reviewed separately.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7119 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-26 22:44:09 +00:00
PSp..om
3e5973793e A better exception for errors that really should have a root
cause.  It's possible to set it right on IOException but not
at all convenient.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7118 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-26 21:32:49 +00:00
PSp..om
7e3020fd07 Forgot to actually check the udp port for server
creation... now it properly disables UDP for -1.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7107 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-24 19:31:30 +00:00
PSp..om
73305755bc Modified so that a -1 UDP port completely disables UDP.
Client and server should match or bad things happen and it
might be worth adding this to the connection negotation
as a validation.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7106 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-24 19:26:09 +00:00
PSp..om
b641b5670c Fixed stupid buffer copy bug partially caused by some
last minute shifts in APIs.  Anyway, outbound TCP
broadcasts work again and are more efficient since the
Kernel callers can better control when their message
buffers are copied (in this case it isn't necessary so
we save a buffer copy).


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7088 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-23 17:45:35 +00:00
PSp..om
862d2729f8 Pull the local UDP port from the ethereal set. The previous
way made the caller specify a local port due to an unusually
persistent bit of ancient lore lodged in my brain.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7086 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-23 17:25:12 +00:00
PSp..om
6ee8fb646c HostedConnection can now supply the Server instance
that is hosting it.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7082 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-23 07:35:21 +00:00
PSp..om
35e19c1667 Applied the null filter fix to the UDP kernel that
has already been applied to the TCP kernel.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7081 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-23 07:34:56 +00:00
PSp..om
6895e1e709 Pass the server name and version on through to the overloaded method.
Cut-paste typo.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7080 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-23 07:04:56 +00:00
PSp..om
82b8cebc16 Unwinding a bit of the Message vs. Message conundrum
to give new API users a proper extension point for their
own messages. (forgot this file in the last commit)


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7070 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-21 23:34:48 +00:00
PSp..om
0fecd032df Unwinding a bit of the Message vs. Message conundrum
to give new API users a proper extension point for their
own messages.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7069 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-21 23:34:13 +00:00
PSp..om
ec7431e0f1 Received messages now have their reliability flag
set properly based on how the message was received.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7068 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-21 23:25:19 +00:00
PSp..om
16c6b13564 Fix client message listeners threading. They may be
called by either the UDP or TCP thread but it will
not be at the same time.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7067 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-21 23:06:27 +00:00
PSp..om
b46a09066d Updated the Endpoint interface to define a close() method
that can optionally flush the queued messages.  Modified
DefaultServer to close-with-flush when kicking a client
so that the disconnect message actually gets to them.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7049 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-19 22:07:19 +00:00
PSp..om
0d23903830 More comments on restrictions to future thread pooling
implementations.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7048 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-19 21:46:52 +00:00
PSp..om
4091a01c91 Modified the default server implementation to enforce my
own threading rules... it's sort of heavy-handed but
given the separation of the reliable and unreliable
implementations (and the inability to really know how
they are threading from here) this is the safest way and
doesn't seem to really affect throughput.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7047 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-19 21:37:02 +00:00
PSp..om
b1e52b865a Added some comments about the multi-threaded nature
of message event dispatch.  This is one of the reasons
I thought the existing services need to be checked for
'correctness' re: multithreading.  Even in the current
implementations, a message listener may be called by
different threads.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7046 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-19 21:21:06 +00:00
PSp..om
382ca44941 Added a count-down latch to keep track of the connecting
state so that if a caller creates a client then immediately
starts sending message, we can block until the connection
is really established.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7044 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-19 17:26:08 +00:00