Archiviert
13
0
Commit graph

374 Commits

Autor SHA1 Nachricht Datum
Kristian S. Stangeland
0e76d8ea2b Make the proxy creation even more flexible.
Now we even support Orebfuscator without using Spout.
2012-10-05 03:12:35 +02:00
Kristian S. Stangeland
18ef06ea21 Adding "support" for Spout by proxying it's NetServerHandler.
While it may seem better to use a Spout PacketListener, we can't
prevent other spout listeners from stopping the listener
chain. For instance, Orebfuscator does supports Spout, but does this
by cancelling every chunk packet and sending them to be processed and
sent by Orebfuscator only. This can never be made compatible with
other plugins.

So, we choose to add some overhead and inject our proxy onto Spout. 
Fortunately, Spout injects the proxy using a player listener on LOWEST, 
so we get to override Spout again with our HIGHEST. The proxy method
should be generic enough to handle most proxy types.
2012-10-05 01:41:17 +02:00
Kristian S. Stangeland
af3e278e06 Moved all player related injection methods into a separate package.
This should make the code a little bit clearer.
2012-10-04 21:56:39 +02:00
Kristian S. Stangeland
eb12808483 Prevent method #3 from creating uneeded proxy objects.
This would happen if the NetServerHandler is already a proxy, and
the injection method is unable to create an instance of the proxy
type. 

It's best to fail instead of polluting (due to constructors with
side-effects) Minecraft with failed proxy objects.
2012-10-04 17:43:46 +02:00
Kristian S. Stangeland
f0651f7170 Don't blow up the fallback method just because a plugin isn't
compatible.
2012-10-04 09:01:33 +02:00
Kristian S. Stangeland
debf8c4d88 Create the worker ID before it is run.
In addition, we'll prevent reuse of worker objects.
2012-10-04 06:23:27 +02:00
Kristian S. Stangeland
af2d692c59 Wait and notify on the correct lock. 2012-10-04 06:13:19 +02:00
Kristian S. Stangeland
db8db1fba1 Make it possible to identify the current worker. 2012-10-04 05:14:17 +02:00
Kristian S. Stangeland
e729583d74 Make the manual asynchronous worker closable.
Added a good deal of synchronization to deal with closing a 
specific worker. This overhead can be avoided by simply closing 
any given worker.
2012-10-04 03:20:09 +02:00
Kristian S. Stangeland
8a5e5e849b Attempt to work around existing injected proxies.
This didn't work for Orebfuscator though.
2012-10-04 00:58:05 +02:00
Kristian S. Stangeland
558eab2253 Use an atomic integer instead of a volatile field.
Incrementing and decrementing is not thread-safe on volatile variables.
2012-10-03 23:13:05 +02:00
Kristian S. Stangeland
c6fb01e1e1 Adding the ability to use multiple worker threads. 2012-10-03 23:10:35 +02:00
Kristian S. Stangeland
eb8ac33a3e Removed uncompleted code. 2012-10-02 23:07:03 +02:00
Kristian S. Stangeland
3f1b5d49e9 Ignore offline players when sending overdue packets. 2012-10-02 23:05:31 +02:00
Kristian S. Stangeland
1e1875cbd8 Speed up the proxy object by using a NoOp filter. 2012-10-02 04:36:47 +02:00
Kristian S. Stangeland
48cedd20d4 Add some size methods. 2012-10-02 04:02:54 +02:00
Kristian S. Stangeland
e4e4581717 Bumping to 1.2.2 2012-10-02 03:55:07 +02:00
Kristian S. Stangeland
2fceaa803e Fixed the "moved too quickly" error that would cause players to
fall out into the void on 1.3.2.
2012-10-02 03:54:50 +02:00
Kristian S. Stangeland
0470b2335c Bumping to 1.2.1 2012-10-01 21:47:36 +02:00
Kristian S. Stangeland
fe55bb2e56 Processed packets is now sorted by the sending index. 2012-10-01 21:47:19 +02:00
Kristian S. Stangeland
7b35dd954c Switching to the network server object. 2012-10-01 20:30:56 +02:00
Kristian S. Stangeland
f4f28023fa Always create the NullPacketListener (unless otherwise stated).
This functions like a crude "counter" that automatically unregisters 
the packet injectors when every asynchronous listener has been removed.
2012-10-01 06:04:31 +02:00
Kristian S. Stangeland
961b34da38 Update documentation (may still need some work). 2012-10-01 04:59:27 +02:00
Kristian S. Stangeland
c2b4b5fce3 Ensure that the compiled structures respect the converter field.
In addition, fixed a bug that prevented client listeners from
receiving any packets.
2012-10-01 02:17:13 +02:00
Kristian S. Stangeland
46d9a6e975 Ensure that the structure compiler is thread safe. 2012-10-01 00:57:14 +02:00
Kristian S. Stangeland
e6de9ae705 Remove debug line. 2012-10-01 00:16:34 +02:00
Kristian S. Stangeland
3ad24921d9 Ensure that hook method #3 receieves Packet0KeepAlive. 2012-10-01 00:16:06 +02:00
Kristian S. Stangeland
9770257a74 Bumping to 1.2.0 2012-09-30 04:49:54 +02:00
Kristian S. Stangeland
f312ce278e Increase the maximum. 2012-09-30 04:44:57 +02:00
Kristian S. Stangeland
73005e032b Forgot to release a semaphore lock. 2012-09-30 04:42:58 +02:00
Kristian S. Stangeland
e666d17dc2 Don't try to find the isAsyncPacket method over and over again. 2012-09-30 04:25:56 +02:00
Kristian S. Stangeland
6063f437fd Another diffcult to track down bug. 2012-09-30 04:24:27 +02:00
Kristian S. Stangeland
1c41f83305 Fixed (probably) a problem reported by Milkywayz.
Relevant crash dump:
2012-09-30 03:39:26 +02:00
Kristian S. Stangeland
801bf81f15 Incredibly difficult bug to track down.
Forgot to remove the "override" flag on cancelled packets when
they're sent again.
2012-09-30 03:24:13 +02:00
Kristian S. Stangeland
0cff9d1243 Ensure that asynchronous listeners are run, even if they have no
accompanying synchronous listener.
2012-09-30 00:51:59 +02:00
Kristian S. Stangeland
c77103246e Small bug fixes. 2012-09-30 00:25:04 +02:00
Kristian S. Stangeland
711990fa15 Simplify the act of creating an asynchronous listener. 2012-09-30 00:13:36 +02:00
Kristian S. Stangeland
63197bbbd5 Add the other cases where we need to know if we're on the main thread
or not.
2012-09-29 23:52:28 +02:00
Kristian S. Stangeland
8a26d047b2 Client packets are processed on the server, so they must be
synchronized with the main thread.
2012-09-29 23:48:09 +02:00
Kristian S. Stangeland
d58ff1c4c1 Properly clean up after async listeners. 2012-09-29 23:21:09 +02:00
Kristian S. Stangeland
15b33925c0 Fixed a couple of minor bugs. 2012-09-29 22:25:09 +02:00
Kristian S. Stangeland
721d92bd4f Fixed a minor bug. 2012-09-29 22:20:21 +02:00
Kristian S. Stangeland
b3098bc6ad Pull up the important methods in the asynchronous packet handler. 2012-09-29 22:18:19 +02:00
Kristian S. Stangeland
e86c3d3a6e We have to keep the setAsyncMarker method. 2012-09-29 22:12:30 +02:00
Kristian S. Stangeland
65b5a0e8ec We don't expect consumers to create asynchronous markers, so
don't allow them to set it in the packet event.
2012-09-29 21:42:16 +02:00
Kristian S. Stangeland
a6db5419c0 Detect packet timeout. 2012-09-29 21:29:12 +02:00
Kristian S. Stangeland
4f4202185c Make it even clearer that the listener loop method should be
called from a separate thread.
2012-09-29 21:18:21 +02:00
Kristian S. Stangeland
025e97ca95 Renamed the ListenerToken in the code as well. 2012-09-29 20:34:29 +02:00
Kristian S. Stangeland
880520cd94 Renamed the ListenerToken into a AsyncListenerHandler. 2012-09-29 20:32:18 +02:00
Kristian S. Stangeland
fad6a0a99c Connect the asynchronous listeners to the system. 2012-09-29 20:30:22 +02:00