blob: 664056d82dc25f62b65ce0a8c014086cfa359ea1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "socket.h"
#include <vespa/fastos/serversocket.h>
namespace vespalib {
namespace ws {
class ServerSocket
{
private:
struct ServerSocketWrapper : public FastOS_ServerSocket {
ServerSocketWrapper(int port) : FastOS_ServerSocket(port, 50) {}
int get_fd() const { return _socketHandle; }
};
ServerSocketWrapper _server_socket;
volatile bool _closed;
public:
ServerSocket(int port_in);
Socket::UP accept();
void close();
int port() { return _server_socket.GetLocalPort(); }
bool is_closed() const { return _closed; }
};
} // namespace vespalib::ws
} // namespace vespalib
|