0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
Commit Graph

43 Commits

Author SHA1 Message Date
Ben Noordhuis
0161ec87af src, lib: deduplicate errnoException 2013-07-20 12:04:35 +02:00
Trevor Norris
278183a902 {stream,udp,tls}_wrap: remove unused offset/length
The function arguments offset and length are now no longer used since
all I/O requests now use discretely allocated memory.
2013-07-03 15:03:41 -07:00
Ben Noordhuis
92023b4b37 dgram: fix no address bind()
I broke dgram.Socket#bind(port, cb) almost a year ago in 332fea5a but
it wasn't until today that someone complained and none of the tests
caught it because they all either specify the address or omit the
callback.

Anyway, now it works again and does what you expect: it binds the
socket to the "any" address ("0.0.0.0" for IPv4 and "::" for IPv6.)
2013-04-18 00:54:57 +02:00
Andreas Madsen
bdf7ac2c5d child_process: support sending dgram socket
child.send can send net servers and sockets. Now that we have support
for dgram clusters this functionality should be extended to include
dgram sockets.
2013-03-07 17:51:17 +01:00
Ben Noordhuis
12d0f0bd3a lib, src: remove errno global
Remove the errno global. It's a property on the process object now.

Fixes #3095.
2013-02-28 23:11:47 +01:00
Bert Belder
6311f1c30a dgram: avoid EventEmitter leak warning
When a datagram socket hasn't been bound yet, node will defer `send()`
operations until binding has completed. Before this patch a `listening`
listener would be installed every time `send` was called. This triggered
an EventEmitter leak warning when more than 10 packets were sent in a
tight loop. Therefore switch to using a single `listening` listener, and
use an array to enqueue outbound packets.
2013-01-28 22:19:02 +01:00
Bert Belder
5e7e51c2fe cluster: support datagram sockets 2013-01-28 22:12:21 +01:00
isaacs
97db62b4d9 Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	AUTHORS
	ChangeLog
	Makefile
	src/node_version.h
2013-01-11 10:18:07 -08:00
Ben Noordhuis
ad6769fc92 dgram: don't assert on send('string')
Raise a TypeError when the argument to send() or sendto() is anything
but a Buffer.

Fixes the following assertion:

  $ node -e 'require("dgram").createSocket("udp4").send("BAM")'
  node: ../../src/udp_wrap.cc:220: static v8::Handle<v8::Value>
  node::UDPWrap::DoSend(const v8::Arguments&, int): Assertion
  `Buffer::HasInstance(args[0])' failed.
  Aborted (core dumped)

Fixes #4496.
2013-01-08 04:32:40 +01:00
Ben Noordhuis
9e32c2ef3e dgram: fix double implicit bind error
Calling send() on an unbound socket forces an implicit bind to
a random port.

332fea5 made the 'listening' event asynchronous. Unfortunately,
it also introduced a bug where the implicit bind was tried more
than once if send() was called again before the first bind operation
completed.

Address that by keeping track of the bind status and making sure that
bind() is called only once.

Fixes #4499.
2012-12-31 17:53:00 +01:00
Ben Noordhuis
61978f57e6 dgram: remove stale code 2012-10-13 01:27:15 +02:00
Ben Noordhuis
332fea5ac1 dgram: make .bind() always asynchronous 2012-07-26 23:55:25 +02:00
Timothy J Fontaine
2637b5c261 ref/unref for net.Socket net.Server dgram.Socket 2012-07-23 18:31:30 +02:00
Ben Noordhuis
d2eaabd0df dgram: hook up handle wrap to owning object 2012-05-15 16:56:48 +02:00
Ben Noordhuis
1ab95a536a udp_wrap: use new slab allocator 2012-03-30 21:24:02 +02:00
ssuda
b72d43cbf9 dgram: fix when we call .close() inside 'listening' 2012-03-06 22:20:23 +01:00
Ben Noordhuis
3502e45b6c dgram: defer send error to next tick 2012-02-23 02:07:39 +01:00
Ben Noordhuis
defa637378 dgram: fix out-of-bound memory read 2012-02-23 02:07:39 +01:00
Seth Fitzsimmons
1ce14eca44 dgram: handle close of dgram socket before DNS lookup completes 2012-02-14 14:10:21 +01:00
Ben Noordhuis
2775c0e97e dgram: bring back setTTL() 2012-01-24 00:11:45 +01:00
Ben Noordhuis
46e86aa803 dgram: bring back setMulticastLoopback() 2012-01-24 00:11:45 +01:00
Ben Noordhuis
6999fb3d1e dgram: make addMembership() and dropMembership() conform to v0.4 API
- throw on error, don't return an error code
2012-01-24 00:05:34 +01:00
Ben Noordhuis
fc6a9673c8 dgram: make setBroadcast() conform to v0.4 API
- don't return a value
2012-01-24 00:05:34 +01:00
Ben Noordhuis
ed111975a0 dgram: make setMulticastTTL() conform to v0.4 API
- throw if the ttl argument is not a number
- return the ttl argument (not particulary useful but it's what v0.4 did)

Note that the 0 < ttl < 256 check has *not* been reinstated. On Linux, -1 is a
valid argument to setsockopt(IPPROTO_IP, IP_TTL).
2012-01-24 00:05:34 +01:00
Dan VerWeire
f2b1f57f74 dgram: reintroduce setMulticastTTL()
Removed during the early stages of node 0.5 refactoring to libuv.
2012-01-21 03:26:09 +01:00
Dan VerWeire
f749338e1e dgram: reintroduce setBroadcast()
Removed during the early stages of node 0.5 refactoring to libuv.
2012-01-21 03:26:04 +01:00
Roman Shtylman
a38fd6056c dgram: reintroduce addMembership() and dropMembership()
Removed during the early stages of node 0.5 refactoring to libuv.
2012-01-21 03:21:51 +01:00
Bert Belder
83152d174c Dgram: correctly report recvmsg errors 2011-11-24 19:11:13 +01:00
Ryan Dahl
71cce3f45b Remove dgram_legacy 2011-10-11 13:26:41 -07:00
Ben Noordhuis
cbd4033619 dgram: integrate libuv UDP support 2011-08-24 22:27:24 +02:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Joe Walnes
df6e497793 dgram: setMulticastTTL, setMulticastLoopback and addMembership.
These are options needed for real-world multicasting.

Implementation notes:
- POSIX only.
- IPv4 only (IPv6 multicast is a tricky beast).
- Didn't update tests, because it can't effectively be demonstrated on
  localhost only.
2011-02-01 10:16:48 -08:00
Ryan Dahl
f22c248e4c more lint 2010-12-01 17:29:11 -08:00
Micheil Smith
8da020d39e Update node_net.cc to make us of node_constants.cc
also affects dgram which uses a constant from node_net.cc
2010-10-25 12:14:47 -07:00
Micheil Smith
e38eb0c5a4 Soft migration of sys -> util, Removal of deprecated utils module. 2010-10-11 15:21:36 -07:00
Ryan Dahl
069d973d74 Remove require('buffer') in built-in libraries. 2010-09-28 02:31:31 -07:00
Ryan Dahl
01b3418e2e Move IOWatcher and Timer to process.binding 2010-09-17 00:15:54 -07:00
Paul Querna
c8f9728de7 Move dns.isIP to net.isIP
Add tests and docs.
2010-09-16 17:27:10 -07:00
Rasmus Andersson
fd3cd755d1 [dgram] only look up hostname for the requested address family
- [lib/dns.js] dns.lookup takes a new optional argument "family" which
  should be the integer 4, 6, dns.AF_INET or dns.AF_INET6. Passing a
  non-false "family" argument makes c-ares explicitly look up addresses for
  the specified family.

- [test/simple/test-c-ares.js] test explicit address family lookups
2010-08-10 17:53:32 -07:00
Matt Ranney
4e50197e53 Datagram socket refactor. Add tests and documentation.
Support setTTL() and setBroadcast() socket options.
2010-07-15 10:27:44 -07:00
Ryan Dahl
cbf2a2233e Add callback to dgramSocket.send() 2010-06-16 11:03:34 -07:00
David Siegel
81ad8106dc Add UDP broadcast support 2010-06-16 10:45:16 -07:00
Paul Querna
02da5ed4a1 Implement datagram sockets
- Adds new dgram module, for all data-gram type transports
- Supports both UDP client and servers
- Supports Unix Daemon sockets in DGRAM mode too (think syslog)
- Uses a shared Buffer and slices that as needed to be reasonably
  performant.
- One supplied test program so far, test-dgram-pingpong
- Passes test cases on osx 10.6 and ubuntu 9.10u
2010-06-12 02:41:45 -07:00