Commit Graph

225 Commits

Author SHA1 Message Date
Matthew Farrellee 24ccdb3008 fix spelling of separate 2015-02-18 17:04:12 -05:00
Miek Gieben 2b6f0d61e5 When locking *do* unlock
Add unlocking to some more places as pointed out by bronze1man.

Really closes #161.
2015-01-13 08:12:02 +00:00
Miek Gieben a07be6b2c1 Server: unlock when already started.
Closes #161
2015-01-11 09:26:00 +00:00
Miek Gieben 79f88fc5d7 fmt 2015-01-11 09:23:26 +00:00
Miek Gieben 8da60e45f5 Remove refs to IsMsg - we are not going to do this 2015-01-08 09:42:46 +00:00
Miek Gieben 2c1a31d550 Small cleanup of the docs 2014-12-12 12:57:47 +00:00
Hugo Landau f039fd8203 Add NotifyStartedFunc field to Server
Adds a field, NotifyStartedFunc func() to Server.

If non-nil, it is called after a server starts listening. This is useful
for synchronization purposes, for example when a daemon needs to drop
privileges after binding. Otherwise, there is no way to determine when
the server has begun listening and hardcoded delays (!) must be used or
race conditions may occur.
2014-12-12 12:51:17 +00:00
Miek Gieben cd2048a15a Add Unsafe member to dns.Server
This stops it from checking if the incoming requests have the QR bit
unset, so be careful when enabling this. This can be useful in
combination with mDNS.

Also the check for only 1 question in the question section is relaxed
to be "at least one", even without setting Unsafe!

Also update TestServingResponse to test for Unsafe vs not using Unsafe.
2014-11-19 16:34:18 +00:00
Bryan Boreham 61478ac390 Removed duplicated test for UDPSize 2014-11-18 15:59:40 +00:00
Miek Gieben d8da4d2fa7 Fix: drop requests with *cough* qr set.
Err, yeah.
2014-10-19 09:36:26 +00:00
Miek Gieben 0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben fbc3e49b78 Some documentation updates 2014-09-02 10:31:15 +00:00
Miek Gieben ebc5489482 Fix datarace in Start/Shutdown
Add mutex and guard a 'started' boolean as well as the stopUDP
and tcpTCP channels so that 'go test -race' does not trigger.

Closes #111, closes #114
2014-08-30 10:34:44 +01:00
Alex Sergeyev fce659ba46 Restored code when shutdown needs an exchange...
Clients sents NULL-packet to server which helps to avoid
timeout. Timeout is still possible to encounter.
Shutdown will likely report error for those cases.
2014-08-29 14:27:53 -04:00
Alex Sergeyev c618657d9b Dealt with race condition detector warnings:
* stopped obvious race condition with replacing handler in
  ServingLargeResponses test
* lowered probability of other race conditions with test code
  while test server is yet activating
* fixed errmessage in Shutdown
2014-08-29 14:10:05 -04:00
Alex Sergeyev ef07b9a69a Following up in introducing getReadTimeout() 2014-08-29 12:26:23 -04:00
Alex Sergeyev f735bb9dcb Changed how shutdown works...
Now stopXXX event will stop any reading on currently open
socket and terminate reading loop. No special client/server
message is required anymore.
2014-08-29 12:24:11 -04:00
Alex Sergeyev 32d6e5396e Continued removing Sleeping tests:
* incorporated @miekg suggestions on switch vs if
* for now moved reaction to stopXXX channel messages until
  after the packet is responded to avoid client timeout in
  Shutdown (causing 2 sec. hanged thread)

Still not great how the abort logic is implemented....
2014-08-29 08:31:27 -04:00
Alex Sergeyev 4b21f37064 Proposed way of creating no-timeout tests and...
... fix for Server.Shutdown() function.
2014-08-28 23:11:49 -04:00
Miek Gieben 2127b822dd Add comment about Systemd 2014-08-28 07:54:23 +00:00
Miek Gieben f0bd4137e2 Make Shutdown return error
This will be handy in feature, so that we can add a 1 second
timeout and then return failure.
2014-08-20 15:12:59 +00:00
Miek Gieben 01bbcbef60 Update documentation for Shutdown.
This completes issue #101.
Fixes #101
2014-08-19 22:08:13 +01:00
Miek Gieben eed2b9aeec Fix Shutdown 2014-08-19 21:56:37 +01:00
Miek Gieben f912994258 Don't relay on deadline to stop the server.
We just send ourselves an UDP or TCP packet so that the listener fails
through and picks up the quit bool send on the channel.
2014-08-19 21:46:00 +01:00
Miek Gieben 6c631cd4ff Implement Shutdown()
This is working for TCP, but for UDP the Read does not honor the
deadline settings.
2014-08-19 09:25:41 +00:00
Miek Gieben 292c925c9f update documentation 2014-08-18 22:21:02 +01:00
Miek Gieben 0d300b1fce Add deadline to the listeners
Call this deadline to the listener will timeout and we will get to
so if the server should shutdown.
2014-08-18 22:14:29 +01:00
Miek Gieben f3a6c86462 Implement Shutdown() call
And fix some tests to call Fatal().
2014-08-18 22:06:29 +01:00
Miek Gieben 6cf24a5637 Add a Shutdown method to server.
Allow gracefull shutdown of a server.
2014-08-18 20:30:10 +01:00
Miek Gieben eb2d26cb96 Remove Pool from server.
A noop for some time, remove it.
2014-08-18 20:29:54 +01:00
Miek Gieben fb3a1585ad fmt 2014-07-27 20:38:11 +01:00
Luke Young 0a6f133b26 Match format of other code 2014-07-27 10:44:39 -07:00
Luke Young 12f91af6ed Added ResponseWriter.LocalAddr support 2014-07-27 10:43:07 -07:00
Miek Gieben 62ee88c895 Documentation 2014-07-22 08:27:59 +01:00
Miek Gieben e1cb18539a Systemd support
Rename StartAndServe to ActivateAndServe and only use one PacketConn or
Listener. This just adds a new entry point into starting a server.
2014-07-21 15:24:55 +01:00
Miek Gieben d80ad4aae5 Add support for systemd socket activation 2014-07-18 20:32:17 +01:00
Miek Gieben d161b9087e Cleanup the PR a bit
Remove code and simplify some functions. Documentation is still on the
todo.
Also don't export any of these functions and/or types.
2014-07-09 21:02:21 +01:00
Omri Bahumi dea4cb300a [ISSUE-95] Send replies from the right source IP address
Fixes #95
2014-07-07 18:16:42 +03:00
Miek Gieben 2ec512f89b server: pool: remove pool implementation
Quite a lot of code for a tiny improvement. Lease the Pool boolean
option in server so current code does not break. Will be removed
in later versions.
2014-04-10 12:59:50 +00:00
Miek Gieben 8e37d3660d Merge branch 'master' of github.com:miekg/dns 2014-01-07 07:45:29 +00:00
Miek Gieben 560a1c65b0 update license in pool.go
remove some build lines as I have no idea what they are
supposed to be doing.
2014-01-06 10:00:25 +00:00
Miek Gieben aafa94f352 better docs 2014-01-05 19:45:30 +00:00
Miek Gieben ac2ee587b1 Pool cleanups, readd wait for TCP 2014-01-05 16:29:07 +00:00
Miek Gieben 05ace47df8 Start of better documentation 2014-01-05 14:14:19 +00:00
Miek Gieben 5c37b9e564 Merge conflict resolved 2014-01-05 14:09:03 +00:00
Miek Gieben 8954a6e7c5 Remove debug logging 2014-01-05 13:51:59 +00:00
Miek Gieben 77345b2073 Don't set timeout
This leads to fake connection in the udp query handling.
2014-01-05 13:41:40 +00:00
Miek Gieben 49ece3e490 Add a memory pool
Re-use memory for UDP queries.
2014-01-05 13:39:33 +00:00
Miek Gieben f094f37de3 Add shortbuf erorr too
Cleanup the pull request a bit.
2014-01-04 11:17:13 +00:00
Miek Gieben b1f108f79c Simplify client TCP write.
Use the same patch as in the server.
2014-01-04 08:30:08 +00:00