Skip to content

Instantly share code, notes, and snippets.

View piscisaureus's full-sized avatar
🦕

Bert Belder piscisaureus

🦕
View GitHub Profile
diff --git a/uv.h b/uv.h
index 5c766e8..569e044 100644
--- a/uv.h
+++ b/uv.h
@@ -224,7 +224,17 @@ int uv_write(uv_req_t* req, uv_buf_t bufs[], int bufcnt);
int uv_timer_init(uv_handle_t* handle, uv_close_cb close_cb, void* data);
int uv_timer_start(uv_handle_t* handle, uv_loop_cb cb, int64_t timeout, int64_t repeat);
int uv_timer_stop(uv_handle_t* handle);
+/* Stop the timer, and if it is repeating restart it using the repeat value
+ * as the timeout. If the timer has never been started before it returns -1 and
@piscisaureus
piscisaureus / dns.c
Created May 25, 2011 02:24
uv dns api
typedef enum {
UV_DNS_A,
UV_DNS_AAAA,
UV_DNS_PTR,
UV_DNS_MX,
UV_DNS_SRV,
... etc ...
} uv_dns_type_t;
From 587f45283732156709d645665279fd156ffebac0 Mon Sep 17 00:00:00 2001
From: Bert Belder <bert@piscisaureus2.(none)>
Date: Fri, 27 May 2011 22:11:42 +0200
Subject: [PATCH 1/1] Use timer_wrap instead of the old timer binding
---
lib/dns.js | 11 +++---
lib/timers.js | 101 ++++++++++++++++++++++++++---------------------------
src/node.cc | 6 ---
src/timer_wrap.cc | 5 ++-
@piscisaureus
piscisaureus / gist:1062552
Created July 3, 2011 19:54
cares_wrap.cc
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
<<>> DiG 9.7.3 <<>> localhost AAAA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 49486
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;localhost. IN AAAA
;; AUTHORITY SECTION:
#include <unistd.h>
int main() {
char text1[10] = "abcdefghi";
char text2[10] = "123456789";
write(1, text1, sizeof(text1));
write(1, (char*) &text2, sizeof(text2));
}
=== release test-tcp-wrap ===
Path: simple/test-tcp-wrap
node.js:189
throw e; // process.nextTick error, or 'error' event on first tick
^
AssertionError: 0 == -1
at Object.<anonymous> (d:\nodejs\node3\test\simple\test-tcp-wrap.js:10:8)
at Module._compile (module.js:406:26)
at Object..js (module.js:445:10)
at Module.load (module.js:334:31)
void __declspec(noinline) uv_update_time() {
00C44170 push esi
DWORD ticks = GetTickCount();
00C44171 call dword ptr [__imp__GetTickCount@0 (0C57078h)]
if (ticks < (LOOP->time & 0xffffffff)) {
00C44177 mov esi,dword ptr [_uv_main_loop_+8 (0C62048h)]
00C4417D xor edx,edx
00C4417F xor ecx,ecx
00C44181 cmp edx,ecx
00C44183 jg uv_update_time+3Ah (0C441AAh)
void __declspec(noinline) uv_update_time() {
000000013FBD9730 sub rsp,28h
DWORD ticks = GetTickCount();
000000013FBD9734 call qword ptr [__imp_GetTickCount (13FBED0F0h)]
if (ticks < (LOOP->time & DWORD_MAX)) {
000000013FBD973A mov rcx,qword ptr [uv_main_loop_+10h (13FBFC890h)]
000000013FBD9741 mov edx,eax
000000013FBD9743 mov eax,ecx
000000013FBD9745 cmp rdx,rax
Before:
[% 0|+ 1|- 0]: ping_pongsping_pongs: 24979 roundtrips/s
[% 0|+ 2|- 0]: tcp_pump100_clienttcp_pump100_client: 1.4 gbit/s
[% 0|+ 3|- 0]: tcp_pump1_clienttcp_pump1_server: 1.4 gbit/s
tcp_pump1_client: 1.4 gbit/s
[% 0|+ 4|- 0]: pipe_pump100_clientpipe_pump100_server: 5.4 gbit/s
pipe_pump100_client: 5.3 gbit/s
[% 0|+ 5|- 0]: pipe_pump1_clientpipe_pump1_server: 5.4 gbit/s
pipe_pump1_client: 5.4 gbit/s
[% 0|+ 6|- 0]: gethostbynameares_gethostbyname: 1000 calls in 146 ms