Commit Graph

79 Commits

Author SHA1 Message Date
Arne Döring
000b8afd26 Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
Euan Torano
3f3853945d Adding test for recvline
Signed-off-by: Euan Torano <euantorano@gmail.com>
2017-07-09 20:50:47 +01:00
Euan T
a5681d03e3 Wait for reads to finish before reading the result
As requested by @dom96, this fixes an issue seen here: https://github.com/nim-lang/redis/pull/4#issuecomment-312713921
2017-07-03 20:13:25 +01:00
Ruslan Mustakov
e0059287bb Add 'hostname' param to wrapConnectedSocket 2017-05-04 16:27:08 +07:00
Ruslan Mustakov
ecf278c467 Implement dial, support IPv6 in httpclient (#5763)
* Implement dial, support IPv6 in httpclient

Added ``dial`` procedure to networking modules: ``net``, ``asyncdispatch``,
``asyncnet``. It merges socket creation, address resolution, and connection
into single step. When using ``dial``, you don't have to worry about
IPv4 vs IPv6 problem.

Fixed addrInfo loop in connect to behave properly.
Previously it would stop on first non-immediate failure, instead of
continuing and trying the remaining addresses.

Fixed newAsyncNativeSocket to raise proper error if socket creation
fails.

Fixes: #3811

* Check domain during connect() only on non-Windows

This is how it was in the previous implementation of connect().

* Call 'osLastError' before 'close' in net.dial

* Record osLastError before freeAddrInfo in net.dial

* Add missing docs for 'dial' proc

* Optimize dial to create one FD per domain, add tests

And make async IPv6 servers work on Windows.

* Add IPv6 test to uri module

* Fix getAddrString error handling
2017-05-02 09:25:50 +02:00
Andreas Rumpf
159643824b fixes #3847 (#5609) 2017-03-27 09:39:46 +02:00
Dominik Picheta
0535b6b6bf Implement SSL SNI hostname setting for asyncnet. 2017-02-08 00:04:40 +01:00
Andreas Rumpf
76eb20d2d3 deprecated nativesockets.dealloc, use freeAddrInfo instead; fixed stdlib deprecations 2017-01-30 08:50:57 +01:00
Dominik Picheta
864946afb8 Add async IO overview to asyncnet module docs. 2017-01-06 12:43:37 +00:00
Federico Ceratto
a8c439afb5 Add OptReuseAddr to example and handle closing 2017-01-02 17:02:20 +00:00
Dominik Picheta
df44c71770 Fixes #4587. 2016-09-25 19:26:28 +02:00
Dominik Picheta
8a6343b5b6 Fixes #3847. 2016-09-25 13:02:10 +02:00
cheatfate
1350d5312b Removed tests with asyncio.
Fix ssl connection drop in asyncnet
Add tasyncssl test
2016-09-07 12:19:06 +03:00
Dominik Picheta
87eb3a105d Some small fixes to changes introduced by #4683. 2016-09-06 20:35:02 +02:00
Anatoly Galiulin
60dbfb2ec9 Revert function names scheme due to the @dom96 comment 2016-09-06 09:31:13 +07:00
Anatoly Galiulin
436a5a01ab Fix typo 2016-09-06 09:31:13 +07:00
Anatoly Galiulin
e4c46e6fba Add async IO operations with buffers on files and sockets 2016-09-06 09:31:13 +07:00
Dominik Picheta
f73dd02787 Fix broken asyncnet module. 2016-06-03 14:21:37 +01:00
Dominik Picheta
8050f43588 Fixed some warnings in httpclient, net, and openssl. 2016-04-04 21:28:21 +01:00
Dominik Picheta
03be03c6e4 Improved asyncnet docs (SSL procs now shown). Deprecated handshake. 2016-04-04 21:00:43 +01:00
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