acl/app/wizard_demo/httpd_proxy/tcp_transfer.h

35 lines
577 B
C
Raw Normal View History

#pragma once
2019-03-14 15:24:11 +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);
~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);
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
ACL_FIBER* peer_fiber(void) const {
return me_;
}
public:
2019-03-14 15:24:11 +08:00
// @override
void run(void);
private:
acl::fiber_tbox<int> box_;
ACL_FIBER* parent_;
ACL_FIBER* me_;
2022-03-31 18:35:14 +08:00
acl::socket_stream* in_;
acl::socket_stream* out_;
tcp_transfer* peer_;
2022-03-31 18:35:14 +08:00
bool is_local_;
2019-03-14 15:24:11 +08:00
};