Supply the strerror as a second arg to the tcp.Connection close event

pull/23362/head
Johan Sørensen 2009-11-13 14:49:32 +01:00 committed by Ryan Dahl
parent 06d493e7e3
commit 04f9c9fb09
1 changed files with 5 additions and 3 deletions

View File

@ -447,10 +447,12 @@ void Connection::OnReceive(const void *buf, size_t len) {
void Connection::OnClose() {
HandleScope scope;
Handle<Value> argv[1];
argv[0] = stream_.errorno == 0 ? False() : True();
Handle<Value> argv[2] = {
stream_.errorno == 0 ? False() : True(),
String::New(strerror(stream_.errorno))
};
Emit("close", 1, argv);
Emit("close", 2, argv);
}
void Connection::OnConnect() {