1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef CEPH_MSG_ACCEPTER_H
16 #define CEPH_MSG_ACCEPTER_H
18 #include "common/Thread.h"
20 class SimpleMessenger;
24 * If the SimpleMessenger binds to a specific address, the Accepter runs
25 * and listens for incoming connections.
27 class Accepter : public Thread {
28 SimpleMessenger *msgr;
34 int create_selfpipe(int *pipe_rd, int *pipe_wr);
37 Accepter(SimpleMessenger *r, uint64_t n)
38 : msgr(r), done(false), listen_sd(-1), nonce(n),
39 shutdown_rd_fd(-1), shutdown_wr_fd(-1)
42 void *entry() override;
44 int bind(const entity_addr_t &bind_addr, const set<int>& avoid_ports);
45 int rebind(const set<int>& avoid_port);