a285695ca8
condition between the omgr thread and the conmgr thread. Now when the omgr thread processes an event that is going out to the clients, it flattents the message itself for each client that is to receive the message and the flattened data is posted to the conmgr outgoing queue. This means that once an event is finished processing, no further modifications to any of the data associated with the event can effect the data queued up to be sent to the client. This is a good thing, it will eliminate or illuminate a very baffling class of bugs that we've sort of been ignoring because we knew this could be the cause. We used to take an event and flatten it directly into the direct buffer from which we would do our socket write. Now we flatten it into a temporary byte array. This means a metric shitload more garbage generation and collection. We used to do the flattening on the conmgr thread, now we do it on the omgr thread. This means a big redistribution of CPU demand. Either of those things could result in a significant negative impact on our performance, but we'll just have to deploy this stuff and find out. Whee! If it turns out to be a serious problem, there are potential optimizations that could be done by keeping a pool of direct buffers around and flattening messages into them, relying on the fact that the outgoing conmgr queue generally doesn't grow too large and we could allocate tens to a hundred megabytes of memory for the outgoing queue if we really needed to. I'd also like to test the overflow handling stuff more. It didn't really change in that everything just deals with arrays of bytes now instead of unflattened messages, but I'll be more comfortable once I've seen all this in action on ice where there may be few users, but they are just as likely to experience lag and receive an overflow queue as users on the higher traffic servers. There is code to log when overflow queues are created and finally flushed and how much use they got while they were around, so that should give us an indication of whether things are operating properly. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3419 542714f4-19e9-0310-aa3c-eee0fc999fb1
50 lines
1.8 KiB
Java
50 lines
1.8 KiB
Java
//
|
|
// $Id$
|
|
//
|
|
// Narya library - tools for developing networked games
|
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
|
// http://www.threerings.net/code/narya/
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it
|
|
// under the terms of the GNU Lesser General Public License as published
|
|
// by the Free Software Foundation; either version 2.1 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this library; if not, write to the Free Software
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
package com.threerings.presents.server;
|
|
|
|
import com.threerings.presents.Log;
|
|
import com.threerings.presents.net.AuthResponse;
|
|
import com.threerings.presents.net.AuthResponseData;
|
|
import com.threerings.presents.server.net.AuthingConnection;
|
|
|
|
/**
|
|
* A simple authenticator implementation that simply accepts all
|
|
* authentication requests.
|
|
*/
|
|
public class DummyAuthenticator extends Authenticator
|
|
{
|
|
/**
|
|
* Accept all authentication requests.
|
|
*/
|
|
public void authenticateConnection (final AuthingConnection conn)
|
|
{
|
|
Log.info("Accepting request: " + conn.getAuthRequest());
|
|
PresentsServer.omgr.postRunnable(new Runnable() {
|
|
public void run () {
|
|
AuthResponseData rdata = new AuthResponseData();
|
|
rdata.code = AuthResponseData.SUCCESS;
|
|
connectionWasAuthenticated(conn, new AuthResponse(rdata));
|
|
}
|
|
});
|
|
}
|
|
}
|