Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/downloader/bioPtr.cxx

Go to the documentation of this file.
00001 // Filename: bioPtr.cxx
00002 // Created by:  drose (15Oct02)
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 "bioPtr.h"
00020 
00021 #ifdef HAVE_SSL
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //     Function: BioPtr::Constructor
00025 //       Access: Public
00026 //  Description: This flavor of the constructor automatically creates
00027 //               a socket BIO and feeds it the server and port name
00028 //               from the indicated URL.  It doesn't call
00029 //               BIO_do_connect(), though.
00030 ////////////////////////////////////////////////////////////////////
00031 BioPtr::
00032 BioPtr(const URLSpec &url) {
00033   _server_name = url.get_server();
00034   _port = url.get_port();
00035   _bio = BIO_new_connect((char *)_server_name.c_str());
00036   BIO_set_conn_int_port(_bio, &_port);
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: BioPtr::Destructor
00041 //       Access: Public
00042 //  Description:
00043 ////////////////////////////////////////////////////////////////////
00044 BioPtr::
00045 ~BioPtr() {
00046   if (_bio != (BIO *)NULL) {
00047     if (downloader_cat.is_debug() && !_server_name.empty()) {
00048       downloader_cat.debug()
00049         << "Dropping connection to " << _server_name << ":" << _port << "\n";
00050     }
00051       
00052     BIO_free_all(_bio);
00053     _bio = (BIO *)NULL;
00054   }
00055 }
00056 
00057 #endif  // HAVE_SSL

Generated on Fri May 2 00:36:42 2003 for Panda by doxygen1.3