00001 // Filename: config_net.cxx 00002 // Created by: drose (25Feb00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "config_net.h" 00020 00021 #include "netDatagram.h" 00022 00023 #include <dconfig.h> 00024 00025 Configure(config_net); 00026 NotifyCategoryDef(net, ""); 00027 00028 ConfigureFn(config_net) { 00029 init_libnet(); 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: init_libnet 00034 // Description: Initializes the library. This must be called at 00035 // least once before any of the functions or classes in 00036 // this library can be used. Normally it will be 00037 // called by the static initializers and need not be 00038 // called explicitly, but special cases exist. 00039 //////////////////////////////////////////////////////////////////// 00040 void 00041 init_libnet() { 00042 static bool initialized = false; 00043 if (initialized) { 00044 return; 00045 } 00046 initialized = true; 00047 00048 NetDatagram::init_type(); 00049 } 00050 00051 // The following two maximum queue sizes are totally arbitrary and 00052 // serve only to provide sanity caps on the various queues in the net 00053 // package. You can set them to any sane values you like. Also see 00054 // the set_max_queue_size() methods in the various classes, which you 00055 // can change at runtime on a particular instance. 00056 00057 // This one limits the number of datagrams in a ConnectionWriter's 00058 // output queue. 00059 int get_net_max_write_queue() { 00060 return config_net.GetInt("net-max-write-queue", 10000); 00061 } 00062 00063 // This one limits the number of datagrams, messages, what have you, 00064 // in the various QueuedConnectionReader, QueuedConnectionListener, 00065 // and QueuedConnectionManager classes. 00066 int get_net_max_response_queue() { 00067 return config_net.GetInt("net-max-response-queue", 10000); 00068 } 00069 00070 bool get_net_error_abort() { 00071 return config_net.GetBool("net-error-abort", false); 00072 }