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-03-31 18:35:14 +08:00
|
|
|
tcp_transfer(ACL_FIBER* parent, 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-03-31 18:35:14 +08:00
|
|
|
void set_peer(tcp_transfer* peer);
|
2022-02-16 23:01:54 +08:00
|
|
|
void unset_peer(void);
|
2022-03-01 19:02:05 +08:00
|
|
|
void close(void);
|
2019-03-14 15:24:11 +08:00
|
|
|
void wait(void);
|
|
|
|
|
2022-03-31 18:35:14 +08:00
|
|
|
void set_local(bool yes);
|
2019-03-14 15:24:11 +08:00
|
|
|
|
2022-03-02 18:33:09 +08:00
|
|
|
ACL_FIBER* peer_fiber(void) const {
|
|
|
|
return me_;
|
|
|
|
}
|
|
|
|
|
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_;
|
2022-03-02 18:33:09 +08:00
|
|
|
ACL_FIBER* parent_;
|
|
|
|
ACL_FIBER* me_;
|
2022-03-31 18:35:14 +08:00
|
|
|
acl::socket_stream* in_;
|
|
|
|
acl::socket_stream* out_;
|
2022-01-18 23:58:40 +08:00
|
|
|
tcp_transfer* peer_;
|
2022-03-31 18:35:14 +08:00
|
|
|
bool is_local_;
|
2019-03-14 15:24:11 +08:00
|
|
|
};
|
|
|
|
|