This quietens the spew so all typical debug info now is coming from
the user code (mirror protocol in the sample server / client case).
Signed-off-by: Andy Green <andy@warmcat.com>
This implements clean client and server close for mux child connections,
and deals with accounting for parent child lists.
The mux link can then survive constant connection bringup and teardown
found in the new test client.
Signed-off-by: Andy Green <andy@warmcat.com>
This is initial x-google-mux support. It's disabled by default
since it's very pre-alpha.
1) To enable it, reconfigure with --enable-x-google-mux
2) It conflicts with deflate-stream, use the -u switch on
the test client to disable deflate-stream
3) It deviates from the google standard by sending full
headers in the addchannel subcommand rather than just
changed ones from original connect
4) Quota is not implemented yet
5) Close of subchannel is not really implemented yet
6) Google opcode 0xf is changed to 0x7 to account for
v7 protocol changes to opcode layout
However despite those caveats, in fact it can run the
test client reliably over one socket (both dumb-increment
and lws-mirror-protocol), you can open a browser on the
same test server too and see the circles, etc.
Signed-off-by: Andy Green <andy@warmcat.com>
While performing handshake recv() is called only once.
It may return only part of the data and handshake
will fail. This patch modifies libwebsocket_service_fd()
to ensure that there is not data left in the socket.
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@auriga.com>
Ago noticed that some Windows clients experience small packets
from the server being aggregated and set after a long delay
(200-300ms).
He found that TCP_NODELAY on the socket solved this, I tested it
and it didn't have any noticable bad effect, so I implemented it
for all sockets, client and server.
Thans Ago for debugging this and notifying the cause.
Reported-by: Ago Allikmaa <maxorator@gmail.com>
Signed-off-by: Andy Green <andy@warmcat.com>
This adds win32 build compatability to libwebsockets.
The patch is from Peter Hinz, Andy Green has cleaned it up a bit and
possibly broken win32 compatability since I can't test it, so there
may be followup patches. It compiles fine under Linux after this
patch anyway.
Much of the patch is changing a reserved keyword for Visual C compiler
"this" to "context", but there is no real C99 support in the MSFT
compiler even though it is 2011 so C99 style array declarations
have been mangled back into "ancient C" style.
Some windows-isms are also added like closesocket() but these are
quite localized. Win32 random is just using C library random() call
at the moment vs Linux /dev/urandom. canonical hostname detection is
broken in win32 at the moment.
Signed-off-by: Peter Hinz <cerebusrc@gmail.com>
Signed-off-by: Andy Green <andy@warmcat.com>
This adds 76/00 client support to libwebsockets. It's still shipped
by browsers and more importantly still the only version supported by
server stuff like socket.io.
Signed-off-by: Andy Green <andy@warmcat.com>
Doing a client connect was atomic until now, blocking
all the other service while it waited for proxy and / or
server response.
This patch uses the new timeout system and breaks the
client connect sequence into three states handled by
the normal poll() processing. It means that there are
now no blocking network delays and it's all handled
by the main state machine.
Signed-off-by: Andy Green <andy@warmcat.com>
This adds a concept of timeouts for operations enforced by
connection closure if the timeout is reached.
Once a second all sockets are checked for timing out, every time
there is a service call it checks to see if a second has passed since
the last check and checks if so.
You can also call libwebsocket_service_fd() with a NULL fd to give
the timeouts a chance to be detected; if it's less than a second since
the last check it returns immediately.
Signed-off-by: Andy Green <andy@warmcat.com>
This patch removes the relationship between position in the
pollfd[] array and any meaning about the type of socket.
It also refactors the service loop so there is a per-fd
function that detects the mode of the connection and services
it accordingly.
The context wsi * array is removed and a hashtable introduced
allowing fast wsi lookup from just the fd that it is
associated with
Signed-off-by: Andy Green <andy@warmcat.com>
This adds 05 support, and -v switches on test-client and test-ping
to allow setting their ietf protocol version to 4 or 5.
It also optimizes the masking to us a function pointer, which
takes some conditionals out of the fast path.
Signed-off-by: Andy Green <andy@warmcat.com>