Commit Graph

48 Commits

Author SHA1 Message Date
Dominik Picheta
c5708ef1ee Merge branch 'exportnewsocket' of https://github.com/boopcat/Nim into boopcat-exportnewsocket
Conflicts:
	lib/pure/asyncnet.nim
2015-06-05 15:06:02 +01:00
pdw
192ba3bbc0 lib/pure/a-c - Dropped 'T' from types 2015-06-04 13:17:11 +02:00
boopcat
af07db2829 Export newSocket(fd) from net.nim and standardize args in net/asyncnet
Exporting newSocket(fd) mimics what asyncnet does and lets you pass in your
 own socket FD.
newSocket*(fd) and newAsyncSocket*(fd) now both take "buffered" instead of
 "isBuff" and defaults to true to match the other constructors on both.
2015-05-30 11:01:15 +00:00
def
1b7cf0e3f3 Add warning about recvLineInto being bound to change 2015-04-26 17:06:41 +02:00
def
84315c6a9c Revert "Introduce FutureVar[T] to make recvLineInto safer."
This reverts commit 72b4912c84.
2015-04-26 17:01:04 +02:00
Dominik Picheta
f4c1c252a7 Fix asyncdispatch on Windows. 2015-04-24 18:12:13 +01:00
Dominik Picheta
72b4912c84 Introduce FutureVar[T] to make recvLineInto safer.
FutureVar[T] is a new distinct Future type which is designed to be used
for situations where the highest performance is needed. It reduces the
number of Future allocations needed. It acts as a replacement for
'var' params in async procs.

This commit modifies @def-'s PR in order to make it safer. The recvLineInto
procedure has been modified to take a ``FutureVar[string]`` param instead of a
``ptr string`` param.
2015-04-24 17:56:04 +01:00
Dominik Picheta
62e1b3e2e3 Some small cleanup. 2015-04-23 21:57:33 +01:00
Dominik Picheta
03cbf689a1 Merge branch 'clean-speedup-2' of https://github.com/def-/Nim into def--clean-speedup-2 2015-04-23 15:26:39 +01:00
Oleh Prypin
32109a7867 Don't run non-test code when defined(testing) 2015-04-21 14:37:29 +03:00
def
ee9499ac89 Some style cleanup 2015-03-17 22:24:12 +01:00
def
134eb6e582 Move recvInto to asyncnet and don't export it 2015-03-17 19:41:05 +01:00
def
836819d6b6 Don't export readInto* templates 2015-03-17 19:40:22 +01:00
def
e127ed77b1 Make recvLineInto a proc instead of template 2015-03-17 19:40:22 +01:00
def
477b3594eb Speed up asynchttpserver significantly using all the previous changes
- Export socket field of AsyncHttpServer and addHeaders proc for templates

- Make respond a template instead of proc because of how often it's called.
  This means no more "await" when invoking it.

- Optimize respond template with special case for empty headers and
  Content-Length entry

- newRequest doesn't allocate a hostname and body anymore because they're
  copied in later

- Major changes to processClient to prevent allocations and copies
2015-03-17 19:39:02 +01:00
def
07a50caf64 Make asyncnet usable when avoiding allocations.
- readInto, readIntoBuf,  are templates instead of procs now

- New recvLineInto template that reads directly into a string instead of
  creating a new one. Used by recvLine proc now

- Need fd and bufLen fields of AsyncSocketDesc exported because of the
  templates

- recv returns a shallow string to prevent copying

- This gives significant speedups, mostly by using templates instead of
  creating new Futures and waiting for them all the time.
2015-03-17 19:39:02 +01:00
Guillaume Gelin
3119fe087d Happy new year! 2015-01-06 15:26:33 +01:00
Dominik Picheta
32db6798a3 Fixes asynchttpsever. 2014-12-26 19:47:25 +00:00
Dominik Picheta
c35182aca7 Fixes #1745. 2014-12-26 19:13:27 +00:00
Dominik Picheta
54219245e7 Fixes SSL AsyncSocket close problem. Ref #1769. Ref #1759. 2014-12-24 01:52:46 +00:00
def
f52fd8785f Fix some deprecation warnings caused by renames 2014-11-13 21:34:46 +01:00
Dominik Picheta
13e3c0d5bb Implement SO_REUSEADDR for asyncnet and asynchttpserver. 2014-11-07 14:48:11 +00:00
Dominik Picheta
83e26cc4fa Fixes asyncnet example. 2014-09-18 18:04:07 +01:00
Dominik Picheta
867dfbfbfa Adds socket creation for arbitrary domain, type and protocol. 2014-09-18 17:03:23 +01:00
Dominik Picheta
efca06c71c Add bool to determine if socket has been closed. 2014-09-16 16:37:53 +01:00
Dominik Picheta
6f155af802 Lots of documentation improvements for asyncdispatch.
Ref #1487.
2014-09-12 22:54:02 +01:00
Dominik Picheta
bd542ebea3 Fixes httpclient SSL issue. Implements unbuffered SSL recv. Ref #1487. 2014-09-06 15:29:38 +01:00
Dominik Picheta
6e321f799a Fixes asynchttpserver. 2014-09-01 21:21:13 +01:00
Dominik Picheta
bb1e87ce4d Async SSL support. 2014-08-31 12:55:04 +01:00
Dominik Picheta
cff2a0c0b4 Case fixes for network modules. 2014-08-30 11:59:08 +01:00
Araq
4523b29d7a Nimrod renamed to Nim 2014-08-28 09:59:26 +02:00
Araq
11b6958755 big rename 2014-08-27 23:42:51 +02:00
Dominik Picheta
a2ec3c91f1 Fix asyncnet example. Rearrange net code. 2014-08-10 12:28:17 +01:00
Dominik Picheta
ef2f377bfa Added SafeDisconn for accept. 2014-08-10 11:39:37 +01:00
Dominik Picheta
4f5f98f0b1 Fixes incorrect async exception handling. Adds sleepAsync.
The tasyncexceptions test has been added which tests for this incorrect
exception handling behaviour. The problem was that the exception was
raised inside a callback which was called from a previously finished async
procedure. This caused a "Future already finished" error. The fix was to
simply reraise the exception if the retFutureSym is already finished.

sleepAsync was added to help with the reproduction of this test. It should
also be useful for users however.

Finally some debug information was added to futures to help with future
bugs.
2014-08-09 17:13:22 +01:00
Dominik Picheta
ac8ddb0720 Implement safe flags for socket operations. 2014-07-13 22:32:39 +01:00
Dominik Picheta
cdcdab49b7 Fix broken async tests. 2014-07-13 11:02:34 +01:00
Dominik Picheta
cf5c8a204e Many async optimisations.
* Selectors implementation will now attempt to immediately execute an IO
  operation instead of waiting for a ready notification.
* Removed recursion in asynchttpserver.
* Improved buffered implementation of recvLine in asyncnet.
* Optimised ``respond`` in asynchttpserver removing a possible "Delayed ACK"
  situation.
2014-07-12 22:51:06 +01:00
Dominik Picheta
6a38d36239 Rename asyncdispatch.close to asyncdispatch.closeSocket. 2014-05-23 13:14:28 +01:00
Dominik Picheta
543687f345 Fixes buffered recv in asyncnet. 2014-04-30 22:50:17 +01:00
Dominik Picheta
3612aca5fe Implemented buffering for asynchronous sockets. 2014-04-13 14:18:47 +01:00
Andreas Rumpf
fe387888bd fixes for asynchttpserver 2014-04-13 00:39:15 +02:00
Dominik Picheta
b2fd562983 Updates docs and news. 2014-04-06 20:46:31 +01:00
Dominik Picheta
4399895d2e Async httpclient should now work. Changed recv behaviour.
asyncdispatch.recv no longer guarantees that it will read ALL the data
requested. The underlying WinAPI function doesn't guarantee this and it
already wasn't guaranteed anyway since the socket could disconnect
mid-transmission.
2014-04-03 20:02:42 +01:00
Dominik Picheta
783087fd57 Implemented async for httpclient. 2014-03-26 16:43:32 +00:00
Dominik Picheta
4ed1ac0078 Move asyncdispatch tests to asyncnet. 2014-03-26 10:31:16 +00:00
Dominik Picheta
d310b01db1 Moved the global dispatcher to asyncdispatch. 2014-03-23 18:24:11 +00:00
Dominik Picheta
192e11e7b7 Many renames. Created high level asyncnet module. 2014-03-22 22:33:53 +00:00