~alan-griffiths/mir/fullscreen-sticks

« back to all changes in this revision

Viewing changes to tests/mir_test_framework/async_server_runner.cpp

  • Committer: Alan Griffiths
  • Date: 2015-11-23 10:45:48 UTC
  • mfrom: (3095.1.18 development-branch)
  • Revision ID: alan@octopull.co.uk-20151123104548-22k2skz9dixhjfqp
mergeĀ lp:mir

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
{
111
111
    server.stop();
112
112
    wait_for_server_exit();
113
 
    connections.clear();
114
113
}
115
114
 
116
115
void mtf::AsyncServerRunner::wait_for_server_exit()
132
131
    return connection(server.open_client_socket());
133
132
}
134
133
 
135
 
auto mtf::AsyncServerRunner::connection(mir::Fd fd) -> std::string
 
134
auto mtf::AsyncServerRunner::connection(int fd) -> std::string
136
135
{
137
136
    char connect_string[64] = {0};
138
 
    connections.push_back(fd);
139
 
    sprintf(connect_string, "fd://%d", fd.operator int());
 
137
    // We can't have both the server and the client owning the same fd, since
 
138
    // that will result in a double-close(). We give the client a duplicate which
 
139
    // the client can safely own (and should close when done).
 
140
    sprintf(connect_string, "fd://%d", dup(fd));
140
141
    return connect_string;
141
142
}