X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/8b9d106fcc61fc84712c97d4db060d8302cc63fd..6623ac357055b95ce4fc0cbe9c5dc15524a9f20c:/rpc/connection.h diff --git a/rpc/connection.h b/rpc/connection.h index b1df8a1..97bacbb 100644 --- a/rpc/connection.h +++ b/rpc/connection.h @@ -4,7 +4,7 @@ #include "types.h" #include #include -#include "pollmgr.h" +#include "poll_mgr.h" #include "file.h" constexpr size_t size_t_max = numeric_limits::max(); @@ -13,10 +13,10 @@ class thread_exit_exception : exception {}; class connection; -class chanmgr { +class connection_delegate { public: virtual bool got_pdu(const shared_ptr & c, const string & b) = 0; - virtual ~chanmgr() {} + virtual ~connection_delegate() {} }; class connection : public aio_callback, public enable_shared_from_this { @@ -26,7 +26,7 @@ class connection : public aio_callback, public enable_shared_from_this create_time() const { return create_time_; } + static shared_ptr to_dst(const sockaddr_in &dst, connection_delegate *mgr, int lossy=0); + private: bool readpdu(); bool writepdu(); - chanmgr *mgr_; + connection_delegate *mgr_; const file_t fd_; bool dead_ = false; @@ -63,7 +65,7 @@ class connection : public aio_callback, public enable_shared_from_this> conns_; void process_accept(); }; - -struct bundle { - bundle(chanmgr *m, int s, int l):mgr(m),tcp(s),lossy(l) {} - chanmgr *mgr; - int tcp; - int lossy; -}; - -shared_ptr connect_to_dst(const sockaddr_in &dst, chanmgr *mgr, int lossy=0); #endif