Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Side by Side Diff: net/socket/tcp_server_socket_libevent.h

Issue 6820057: Added TCPServerSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/Bind/Listen/ Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_
6 #define NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_
7
8 #include "base/message_loop.h"
9 #include "base/threading/non_thread_safe.h"
10 #include "net/base/completion_callback.h"
11 #include "net/socket/tcp_client_socket.h"
12
13 namespace net {
14
15 class IPEndPoint;
16
17 class TCPServerSocketLibevent : public base::NonThreadSafe,
18 public MessageLoopForIO::Watcher {
19 public:
20 TCPServerSocketLibevent(net::NetLog* net_log,
21 const net::NetLog::Source& source);
22 ~TCPServerSocketLibevent();
23
24 // Bind the socket and start listening.
willchan no longer on Chromium 2011/04/13 16:08:51 I guess it's implicit, but you might want to docum
Sergey Ulanov 2011/04/13 21:20:19 Done.
25 int Listen(const net::IPEndPoint& address, int backlog);
26
27 // Gets current address the socket is bound to.
28 int GetLocalAddress(IPEndPoint* address) const;
29
30 // Accept connection. Callback is called when new connection is
31 // accepted.
32 int Accept(TCPClientSocket** socket, IPEndPoint* address,
willchan no longer on Chromium 2011/04/13 16:08:51 http://dev.chromium.org/developers/coding-style#Co
Sergey Ulanov 2011/04/13 21:20:19 Done.
33 CompletionCallback* callback);
34
35 // MessageLoopForIO::Watcher implementation.
36 virtual void OnFileCanReadWithoutBlocking(int fd);
37 virtual void OnFileCanWriteWithoutBlocking(int fd);
38
39 private:
40 int AcceptInternal(TCPClientSocket** socket, net::IPEndPoint* address);
41 void Close();
42
43 int socket_;
44
45 MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_;
46
47 TCPClientSocket** accept_socket_;
48 IPEndPoint* accept_address_;
49 CompletionCallback* accept_callback_;
50
51 net::NetLog* net_log_;
52 net::NetLog::Source net_log_source_;
53 };
54
55 } // namespace net
56
57 #endif // NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698