mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
support closing sockets explicitly
This commit is contained in:
parent
1b9191f48e
commit
5e5abe8c50
@ -48,18 +48,6 @@ open(BioPtr *source) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IBioStream::close
|
||||
// Access: Public
|
||||
// Description: Resets the BioStream to empty, but does not actually
|
||||
// close the source BIO unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE IBioStream &IBioStream::
|
||||
close() {
|
||||
_buf.close();
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: OBioStream::Constructor
|
||||
// Access: Public
|
||||
@ -91,18 +79,6 @@ open(BioPtr *source) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: OBioStream::close
|
||||
// Access: Public
|
||||
// Description: Resets the BioStream to empty, but does not actually
|
||||
// close the source BIO unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE OBioStream &OBioStream::
|
||||
close() {
|
||||
_buf.close();
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BioStream::Constructor
|
||||
// Access: Public
|
||||
@ -133,15 +109,3 @@ open(BioPtr *source) {
|
||||
_buf.open(source);
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BioStream::close
|
||||
// Access: Public
|
||||
// Description: Resets the BioStream to empty, but does not actually
|
||||
// close the source BIO unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BioStream &BioStream::
|
||||
close() {
|
||||
_buf.close();
|
||||
return *this;
|
||||
}
|
||||
|
@ -37,6 +37,17 @@ is_closed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IBioStream::close
|
||||
// Access: Public, Virtual
|
||||
// Description: Resets the BioStream to empty, but does not actually
|
||||
// close the source BIO unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void IBioStream::
|
||||
close() {
|
||||
_buf.close();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: OBioStream::is_closed
|
||||
// Access: Public, Virtual
|
||||
@ -54,6 +65,17 @@ is_closed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: OBioStream::close
|
||||
// Access: Public, Virtual
|
||||
// Description: Resets the BioStream to empty, but does not actually
|
||||
// close the source BIO unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void OBioStream::
|
||||
close() {
|
||||
_buf.close();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BioStream::is_closed
|
||||
// Access: Public, Virtual
|
||||
@ -71,4 +93,15 @@ is_closed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BioStream::close
|
||||
// Access: Public, Virtual
|
||||
// Description: Resets the BioStream to empty, but does not actually
|
||||
// close the source BIO unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void BioStream::
|
||||
close() {
|
||||
_buf.close();
|
||||
}
|
||||
|
||||
#endif // HAVE_SSL
|
||||
|
@ -42,9 +42,9 @@ public:
|
||||
INLINE IBioStream(BioPtr *source);
|
||||
|
||||
INLINE IBioStream &open(BioPtr *source);
|
||||
INLINE IBioStream &close();
|
||||
|
||||
virtual bool is_closed();
|
||||
virtual void close();
|
||||
|
||||
private:
|
||||
BioStreamBuf _buf;
|
||||
@ -65,9 +65,9 @@ public:
|
||||
INLINE OBioStream(BioPtr *source);
|
||||
|
||||
INLINE OBioStream &open(BioPtr *source);
|
||||
INLINE OBioStream &close();
|
||||
|
||||
virtual bool is_closed();
|
||||
virtual void close();
|
||||
|
||||
private:
|
||||
BioStreamBuf _buf;
|
||||
@ -84,9 +84,9 @@ public:
|
||||
INLINE BioStream(BioPtr *source);
|
||||
|
||||
INLINE BioStream &open(BioPtr *source);
|
||||
INLINE BioStream &close();
|
||||
|
||||
virtual bool is_closed();
|
||||
virtual void close();
|
||||
|
||||
private:
|
||||
BioStreamBuf _buf;
|
||||
|
@ -194,6 +194,7 @@ underflow() {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
size_t BioStreamBuf::
|
||||
write_chars(const char *start, size_t length) {
|
||||
if (length != 0) {
|
||||
size_t wrote_so_far = 0;
|
||||
|
||||
int write_count = BIO_write(*_source, start, length);
|
||||
@ -228,6 +229,7 @@ write_chars(const char *start, size_t length) {
|
||||
// Try to write some more.
|
||||
write_count = BIO_write(*_source, start + wrote_so_far, length - wrote_so_far);
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
@ -47,15 +47,3 @@ open(BioStreamPtr *source, HTTPChannel *doc) {
|
||||
_buf.open_read(source, doc);
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IChunkedStream::close
|
||||
// Access: Public
|
||||
// Description: Resets the ChunkedStream to empty, but does not actually
|
||||
// close the source CHUNKED unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE IChunkedStream &IChunkedStream::
|
||||
close() {
|
||||
_buf.close_read();
|
||||
return *this;
|
||||
}
|
||||
|
@ -37,4 +37,15 @@ is_closed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IChunkedStream::close
|
||||
// Access: Public, Virtual
|
||||
// Description: Resets the ChunkedStream to empty, but does not actually
|
||||
// close the source BIO unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void IChunkedStream::
|
||||
close() {
|
||||
_buf.close_read();
|
||||
}
|
||||
|
||||
#endif // HAVE_SSL
|
||||
|
@ -45,9 +45,9 @@ public:
|
||||
INLINE IChunkedStream(BioStreamPtr *source, HTTPChannel *doc);
|
||||
|
||||
INLINE IChunkedStream &open(BioStreamPtr *source, HTTPChannel *doc);
|
||||
INLINE IChunkedStream &close();
|
||||
|
||||
virtual bool is_closed();
|
||||
virtual void close();
|
||||
|
||||
private:
|
||||
ChunkedStreamBuf _buf;
|
||||
|
@ -51,15 +51,3 @@ open(BioStreamPtr *source, HTTPChannel *doc,
|
||||
_buf.open_read(source, doc, has_content_length, content_length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IIdentityStream::close
|
||||
// Access: Public
|
||||
// Description: Resets the IdentityStream to empty, but does not actually
|
||||
// close the source IDENTITY unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE IIdentityStream &IIdentityStream::
|
||||
close() {
|
||||
_buf.close_read();
|
||||
return *this;
|
||||
}
|
||||
|
@ -38,4 +38,15 @@ is_closed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IIdentityStream::close
|
||||
// Access: Public, Virtual
|
||||
// Description: Resets the IdentityStream to empty, but does not actually
|
||||
// close the source BIO unless owns_source was true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void IIdentityStream::
|
||||
close() {
|
||||
_buf.close_read();
|
||||
}
|
||||
|
||||
#endif // HAVE_SSL
|
||||
|
@ -52,9 +52,9 @@ public:
|
||||
|
||||
INLINE IIdentityStream &open(BioStreamPtr *source, HTTPChannel *doc,
|
||||
bool has_content_length, size_t content_length);
|
||||
INLINE IIdentityStream &close();
|
||||
|
||||
virtual bool is_closed();
|
||||
virtual void close();
|
||||
|
||||
private:
|
||||
IdentityStreamBuf _buf;
|
||||
|
@ -48,6 +48,7 @@ PUBLISHED:
|
||||
bool receive_datagram(Datagram &dg);
|
||||
|
||||
virtual bool is_closed() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
private:
|
||||
size_t _data_expected;
|
||||
@ -70,6 +71,7 @@ PUBLISHED:
|
||||
bool send_datagram(const Datagram &dg);
|
||||
|
||||
virtual bool is_closed() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
INLINE void set_collect_tcp(bool collect_tcp);
|
||||
INLINE bool get_collect_tcp() const;
|
||||
@ -99,6 +101,7 @@ PUBLISHED:
|
||||
bool send_datagram(const Datagram &dg);
|
||||
|
||||
virtual bool is_closed() = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
INLINE void set_collect_tcp(bool collect_tcp);
|
||||
INLINE bool get_collect_tcp() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user