~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to src/client/rpc/stream_socket_transport.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-10-10 14:01:26 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20141010140126-n1czko8na1kuz4ll
Tags: upstream-0.8.0+14.10.20141010
ImportĀ upstreamĀ versionĀ 0.8.0+14.10.20141010

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define STREAM_SOCKET_TRANSPORT_H_
22
22
 
23
23
#include "stream_transport.h"
 
24
#include "mir/fd.h"
24
25
 
25
26
#include <thread>
26
27
#include <mutex>
35
36
class StreamSocketTransport : public StreamTransport
36
37
{
37
38
public:
38
 
    StreamSocketTransport(int fd);
 
39
    StreamSocketTransport(Fd const& fd);
39
40
    StreamSocketTransport(std::string const& socket_path);
40
41
    ~StreamSocketTransport() override;
41
42
 
42
43
    void register_observer(std::shared_ptr<Observer> const& observer) override;
43
44
    void receive_data(void* buffer, size_t bytes_requested) override;
44
 
    void receive_data(void* buffer, size_t bytes_requested, std::vector<int>& fds) override;
 
45
    void receive_data(void* buffer, size_t bytes_requested, std::vector<Fd>& fds) override;
45
46
    void send_data(const std::vector<uint8_t> &buffer) override;
46
47
 
47
48
private:
48
49
    void init();
49
 
    int open_socket(std::string const& path);
 
50
    Fd open_socket(std::string const& path);
50
51
    void notify_data_available();
51
52
    void notify_disconnected();
52
53
 
53
54
    std::thread io_service_thread;
54
 
    int const socket_fd;
55
 
    int shutdown_fd;
 
55
    Fd const socket_fd;
 
56
    Fd shutdown_fd;
56
57
 
57
58
    std::mutex observer_mutex;
58
59
    std::vector<std::shared_ptr<Observer>> observers;