2019-07-28 10:31:56 +08:00
|
|
|
#pragma once
|
2019-03-14 15:24:11 +08:00
|
|
|
|
2022-01-18 23:58:40 +08:00
|
|
|
class tcp_transfer : public acl::fiber
|
2019-03-14 15:24:11 +08:00
|
|
|
{
|
|
|
|
public:
|
2022-02-15 22:34:10 +08:00
|
|
|
tcp_transfer(acl::socket_stream& in, acl::socket_stream& out, bool running);
|
2022-01-18 23:58:40 +08:00
|
|
|
~tcp_transfer(void);
|
2019-03-14 15:24:11 +08:00
|
|
|
|
2022-01-18 23:58:40 +08:00
|
|
|
void set_peer(tcp_transfer& peer);
|
2022-02-16 23:01:54 +08:00
|
|
|
void unset_peer(void);
|
2019-03-14 15:24:11 +08:00
|
|
|
void wait(void);
|
|
|
|
|
|
|
|
acl::socket_stream& get_input(void) const
|
|
|
|
{
|
|
|
|
return in_;
|
|
|
|
}
|
|
|
|
|
|
|
|
acl::socket_stream& get_output(void) const
|
|
|
|
{
|
|
|
|
return out_;
|
|
|
|
}
|
|
|
|
|
2022-02-15 22:34:10 +08:00
|
|
|
public:
|
2019-03-14 15:24:11 +08:00
|
|
|
// @override
|
|
|
|
void run(void);
|
|
|
|
|
|
|
|
private:
|
|
|
|
acl::fiber_tbox<int> box_;
|
|
|
|
acl::socket_stream& in_;
|
|
|
|
acl::socket_stream& out_;
|
2022-01-18 23:58:40 +08:00
|
|
|
tcp_transfer* peer_;
|
2019-03-14 15:24:11 +08:00
|
|
|
};
|
|
|
|
|