Panda3D
 All Classes Functions Variables Enumerations
chunkedStream.cxx
1 // Filename: chunkedStream.cxx
2 // Created by: drose (25Sep02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "chunkedStream.h"
16 
17 // This module is not compiled if OpenSSL is not available.
18 #ifdef HAVE_OPENSSL
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: IChunkedStream::Destructor
22 // Access: Published, Virtual
23 // Description:
24 ////////////////////////////////////////////////////////////////////
25 IChunkedStream::
26 ~IChunkedStream() {
27  if (_channel != (HTTPChannel *)NULL) {
28  _channel->body_stream_destructs(this);
29  _channel = NULL;
30  }
31 }
32 
33 ////////////////////////////////////////////////////////////////////
34 // Function: IChunkedStream::is_closed
35 // Access: Public, Virtual
36 // Description: Returns true if the last eof condition was triggered
37 // because the socket has genuinely closed, or false if
38 // we can expect more data to come along shortly.
39 ////////////////////////////////////////////////////////////////////
40 bool IChunkedStream::
41 is_closed() {
42  if (_buf._done || _buf.is_closed()) {
43  return true;
44  }
45  clear();
46  return false;
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: IChunkedStream::close
51 // Access: Public, Virtual
52 // Description: Resets the ChunkedStream to empty, but does not actually
53 // close the source BIO unless owns_source was true.
54 ////////////////////////////////////////////////////////////////////
55 void IChunkedStream::
56 close() {
57  _buf.close_read();
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: IChunkedStream::get_read_state
62 // Access: Public, Virtual
63 // Description: Returns an enum indicating how we are coming along in
64 // reading the document.
65 ////////////////////////////////////////////////////////////////////
66 IChunkedStream::ReadState IChunkedStream::
67 get_read_state() {
68  return _buf.get_read_state();
69 }
70 
71 #endif // HAVE_OPENSSL