mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine get_send_timeout in time unit
This commit is contained in:
parent
f4bee37e76
commit
38bbf6b111
9 changed files with 34 additions and 50 deletions
|
@ -29,7 +29,7 @@
|
|||
#include <srs_kernel_io.hpp>
|
||||
|
||||
/**
|
||||
* the system io reader/writer architecture:
|
||||
* The system io reader/writer architecture:
|
||||
* +---------------+ +---------------+
|
||||
* | IStreamWriter | | IVectorWriter |
|
||||
* +---------------+ +---------------+
|
||||
|
@ -59,22 +59,18 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* get the statistic of channel.
|
||||
* Get the statistic of channel.
|
||||
*/
|
||||
class ISrsProtocolStatistic
|
||||
{
|
||||
public:
|
||||
ISrsProtocolStatistic();
|
||||
virtual ~ISrsProtocolStatistic();
|
||||
// for protocol
|
||||
// For protocol
|
||||
public:
|
||||
/**
|
||||
* get the total recv bytes over underlay fd.
|
||||
*/
|
||||
// Get the total recv bytes over underlay fd.
|
||||
virtual int64_t get_recv_bytes() = 0;
|
||||
/**
|
||||
* get the total send bytes over underlay fd.
|
||||
*/
|
||||
// Get the total send bytes over underlay fd.
|
||||
virtual int64_t get_send_bytes() = 0;
|
||||
};
|
||||
|
||||
|
@ -88,21 +84,15 @@ public:
|
|||
virtual ~ISrsProtocolReader();
|
||||
// for protocol
|
||||
public:
|
||||
/**
|
||||
* Set the timeout tm in ms for recv bytes from peer.
|
||||
* @remark Use SRS_UTIME_NO_TIMEOUT to never timeout.
|
||||
*/
|
||||
// Set the timeout tm in ms for recv bytes from peer.
|
||||
// @remark Use SRS_UTIME_NO_TIMEOUT to never timeout.
|
||||
virtual void set_recv_timeout(int64_t tm) = 0;
|
||||
/**
|
||||
* Get the timeout in ms for recv bytes from peer.
|
||||
*/
|
||||
// Get the timeout in ms for recv bytes from peer.
|
||||
virtual int64_t get_recv_timeout() = 0;
|
||||
// for handshake.
|
||||
// For handshake.
|
||||
public:
|
||||
/**
|
||||
* read specified size bytes of data
|
||||
* @param nread, the actually read size, NULL to ignore.
|
||||
*/
|
||||
// Read specified size bytes of data
|
||||
// @param nread, the actually read size, NULL to ignore.
|
||||
virtual srs_error_t read_fully(void* buf, size_t size, ssize_t* nread) = 0;
|
||||
};
|
||||
|
||||
|
@ -114,32 +104,26 @@ class ISrsProtocolWriter : virtual public ISrsWriter, virtual public ISrsProtoco
|
|||
public:
|
||||
ISrsProtocolWriter();
|
||||
virtual ~ISrsProtocolWriter();
|
||||
// for protocol
|
||||
// For protocol
|
||||
public:
|
||||
/**
|
||||
* Set the timeout tm in srs_utime_t for send bytes to peer.
|
||||
* @remark Use SRS_UTIME_NO_TIMEOUT to never timeout.
|
||||
*/
|
||||
// Set the timeout tm in srs_utime_t for send bytes to peer.
|
||||
// @remark Use SRS_UTIME_NO_TIMEOUT to never timeout.
|
||||
virtual void set_send_timeout(srs_utime_t tm) = 0;
|
||||
/**
|
||||
* Get the timeout in ms for send bytes to peer.
|
||||
*/
|
||||
virtual int64_t get_send_timeout() = 0;
|
||||
// Get the timeout in srs_utime_t for send bytes to peer.
|
||||
virtual srs_utime_t get_send_timeout() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* the reader and writer.
|
||||
* The reader and writer.
|
||||
*/
|
||||
class ISrsProtocolReadWriter : virtual public ISrsProtocolReader, virtual public ISrsProtocolWriter
|
||||
{
|
||||
public:
|
||||
ISrsProtocolReadWriter();
|
||||
virtual ~ISrsProtocolReadWriter();
|
||||
// for protocol
|
||||
// For protocol
|
||||
public:
|
||||
/**
|
||||
* Whether the specified tm in ms is never timeout.
|
||||
*/
|
||||
// Whether the specified tm in ms is never timeout.
|
||||
virtual bool is_never_timeout(int64_t tm) = 0;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue