Commit Graph

59 Commits

Author SHA1 Message Date
Adam Strzelecki
be991ed413 Rename rawsockets module to nativesockets
This change was done to avoid confusion with TCP/IP raw sockets. Native sockets
module represents handling native system low level socket API in general and is
not just limited anyhow to TCP/IP raw sockets.

A stub lib/deprecated/pure/rawsockets.nim module has been added as
compatibility layer for old code using rawsockets, so this change will not
break existing code.
2015-10-03 19:45:41 +02:00
Dominik Picheta
492f5eb704 Fixes asyncnet.recvLine. Fixes #3346. 2015-09-19 14:01:45 +01:00
Dominik Picheta
28e3ad945a Reintroduce FutureVar[T] from commit 72b4912c84. 2015-09-11 13:03:59 +01:00
Bruce Doan
55ef708e73 Free SSL handler to avoid memory leaks 2015-07-31 01:24:35 +07:00
Dominik Picheta
615defb1a9 Fixes socket problems on Windows and normalises some names.
Ref #2976. Ref #2003. See news.txt for details.
2015-06-29 20:11:21 +01:00
Andrew Yourtchenko
c42b08988c Make newAsyncSocket AF_INET6 the default domain. 2015-06-23 23:03:35 +02:00
Andrew Yourtchenko
93e2d9f979 Make asyncnet.bindAddr IPv4+IPv6 compatible. 2015-06-23 23:02:10 +02:00
Dominik Picheta
68f583ddb7 Adjustments to #2610. 2015-06-22 21:40:38 +01:00
Dominik Picheta
8853dfb353 Merge branch 'starttls' of https://github.com/wiml/Nim into wiml-starttls
Conflicts:
	lib/pure/net.nim
2015-06-22 21:34:21 +01:00
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
Wim Lewis
df1cdced1d Make the post-connection wrapSocket() call available in both the synchronous and asynchrinous net modules. 2015-04-26 22:10:35 -07: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
Wim Lewis
9c19ce0698 Add a handshake parameter to wrapSocket() to allow it to work on an already-connected socket. 2015-04-23 20:45:33 -07: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