mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
cleanup: rename some of the callbacks
This commit is contained in:
1 parent
1713386580
commit
13062832d8
2 files changed
+17
-16
No files matched your search
+8
-8
@@ -94,12 +94,12 @@ Connection::Connection (Handle<Object> handle)
|
||||
port_ = NULL;
|
||||
|
||||
oi_socket_init(&socket_, timeout);
|
||||
socket_.on_connect = Connection::_OnConnect;
|
||||
socket_.on_read = Connection::_OnReceive;
|
||||
socket_.on_drain = Connection::_OnDrain;
|
||||
socket_.on_error = Connection::_OnError;
|
||||
socket_.on_close = Connection::_OnDisconnect;
|
||||
socket_.on_timeout = Connection::_OnTimeout;
|
||||
socket_.on_connect = Connection::on_connect;
|
||||
socket_.on_read = Connection::on_read;
|
||||
socket_.on_drain = Connection::on_drain;
|
||||
socket_.on_error = Connection::on_error;
|
||||
socket_.on_close = Connection::on_close;
|
||||
socket_.on_timeout = Connection::on_timeout;
|
||||
socket_.data = this;
|
||||
}
|
||||
|
||||
@@ -370,8 +370,8 @@ Acceptor::Acceptor (Handle<Object> handle, Handle<Object> options)
|
||||
}
|
||||
|
||||
oi_server_init(&server_, backlog);
|
||||
server_.on_connection = Acceptor::_OnConnection;
|
||||
server_.on_error = Acceptor::_OnError;
|
||||
server_.on_connection = Acceptor::on_connection;
|
||||
server_.on_error = Acceptor::on_error;
|
||||
server_.data = this;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,12 +53,13 @@ protected:
|
||||
v8::Handle<v8::Object> server);
|
||||
|
||||
private:
|
||||
static void _OnConnect (oi_socket *s) {
|
||||
/* liboi callbacks */
|
||||
static void on_connect (oi_socket *s) {
|
||||
Connection *connection = static_cast<Connection*> (s->data);
|
||||
connection->OnConnect();
|
||||
}
|
||||
|
||||
static void _OnReceive (oi_socket *s, const void *buf, size_t len) {
|
||||
static void on_read (oi_socket *s, const void *buf, size_t len) {
|
||||
Connection *connection = static_cast<Connection*> (s->data);
|
||||
if (len == 0)
|
||||
connection->OnEOF();
|
||||
@@ -66,22 +67,22 @@ private:
|
||||
connection->OnReceive(buf, len);
|
||||
}
|
||||
|
||||
static void _OnDrain (oi_socket *s) {
|
||||
static void on_drain (oi_socket *s) {
|
||||
Connection *connection = static_cast<Connection*> (s->data);
|
||||
connection->OnDrain();
|
||||
}
|
||||
|
||||
static void _OnError (oi_socket *s, oi_error e) {
|
||||
static void on_error (oi_socket *s, oi_error e) {
|
||||
Connection *connection = static_cast<Connection*> (s->data);
|
||||
connection->OnError(e);
|
||||
}
|
||||
|
||||
static void _OnDisconnect (oi_socket *s) {
|
||||
static void on_close (oi_socket *s) {
|
||||
Connection *connection = static_cast<Connection*> (s->data);
|
||||
connection->OnDisconnect();
|
||||
}
|
||||
|
||||
static void _OnTimeout (oi_socket *s) {
|
||||
static void on_timeout (oi_socket *s) {
|
||||
Connection *connection = static_cast<Connection*> (s->data);
|
||||
connection->OnTimeout();
|
||||
}
|
||||
@@ -124,7 +125,7 @@ protected:
|
||||
static v8::Handle<v8::Value> v8Close (const v8::Arguments& args);
|
||||
|
||||
private:
|
||||
static oi_socket* _OnConnection (oi_server *s, struct sockaddr *addr, socklen_t len) {
|
||||
static oi_socket* on_connection (oi_server *s, struct sockaddr *addr, socklen_t len) {
|
||||
Acceptor *acceptor = static_cast<Acceptor*> (s->data);
|
||||
Connection *connection = acceptor->OnConnection (addr, len);
|
||||
if (connection)
|
||||
@@ -133,7 +134,7 @@ private:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void _OnError (oi_server *s, struct oi_error error) {
|
||||
static void on_error (oi_server *s, struct oi_error error) {
|
||||
Acceptor *acceptor = static_cast<Acceptor*> (s->data);
|
||||
acceptor->OnError (error);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user