Commit graph

4948 commits

Author SHA1 Message Date
Ashod Nakashian
62c4828af6 nb: add OpenSSL dependency and initialization
Change-Id: I0d369acbc95db5d2b678032632ac4edfa561cbad
Reviewed-on: https://gerrit.libreoffice.org/34354
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:37 +01:00
Ashod Nakashian
6a3242ce96 wsd: no tabs
Change-Id: I0537f7437328cb758e691d8e0ddc12d78da11f6a
Reviewed-on: https://gerrit.libreoffice.org/34353
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:37 +01:00
Ashod Nakashian
1920481aca nb: refactor buffer management into BufferingSocket
Now we have plain and ssl sockets based on
the BufferingSocket, each is responsible for
the socket IO only.

The SSL socket is only shell missing implementation.

Change-Id: I51d274a9335cec52c13b6a19927ddd46d98265a0
Reviewed-on: https://gerrit.libreoffice.org/34352
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:37 +01:00
Ashod Nakashian
b5efc65cef nb: ClientSocket -> StreamSocket
StreamSocket has nothing Client-side specific.

Indeed it could be used on the Server-side.

As such, it's data-streaming, rather than client,
hence the new name.

Change-Id: I4e048def968b3a12e11edb49760ed03e3843ae6b
Reviewed-on: https://gerrit.libreoffice.org/34351
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:37 +01:00
Ashod Nakashian
ae14786443 nb: retry on EINTR
Change-Id: Iea972096854308a80f96af056639417be7573a82
Reviewed-on: https://gerrit.libreoffice.org/34350
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:37 +01:00
Michael Meeks
3b0b31f5e2 WS: initial masking implementation & better parsing. 2017-03-10 10:47:37 +01:00
Michael Meeks
568569659b WS - basic handshake / upgrade and start of read framing. 2017-03-10 10:47:37 +01:00
Michael Meeks
b16ead036f More WS-ness. 2017-03-10 10:47:37 +01:00
Michael Meeks
d9ff82ce83 Websocket client test with WS=1 2017-03-10 10:47:37 +01:00
Michael Meeks
2f5d3e4412 Bang on the server with some threads. 2017-03-10 10:47:37 +01:00
Michael Meeks
23270347e5 Thread to poke server. 2017-03-10 10:47:36 +01:00
Michael Meeks
a06fb365cb Get number response / ping bits working. 2017-03-10 10:47:36 +01:00
Michael Meeks
7a225dcbb3 Lean on Poco for request parsing. 2017-03-10 10:47:36 +01:00
Michael Meeks
d254899e74 Initial http header parsing pieces. 2017-03-10 10:47:36 +01:00
Michael Meeks
feb8192ec3 De-templatize and simplify. 2017-03-10 10:47:36 +01:00
Michael Meeks
0263078de7 Handle EOF - ie. zero length reads on sockets.
Close and cleanup sockets nicely.
2017-03-10 10:47:36 +01:00
Michael Meeks
1a1b1dacc9 hush 2017-03-10 10:47:36 +01:00
Michael Meeks
92364f3ebf Implement basic buffering.
The socket now buffers input, and output, updates its poll record too.
We pass a simple message from client to server and back using lamers HTTP.
Sub-classed ClientSocket to provide a simple message handler.
   not very convinced by templatization here, but made it consistent.
   more ideal to have some virtual socket pieces.
2017-03-10 10:47:36 +01:00
Michael Meeks
8f1ae36c8a First cut at a Poco based client. 2017-03-10 10:47:36 +01:00
Michael Meeks
257a79da89 Cleanup comments, naming related warnings etc.
Avoid using 'poll' as a member function, and a local variable.
Avoid using 'fd' as a member function, and a parameter.
Add assertions around wake pipe.
Always setup sockets for polling, strobing events is expected.
2017-03-10 10:47:36 +01:00
Ashod Nakashian
0a05a34f66 nb: move Socket family into own file
Change-Id: I17802f00a6e9e7d920b175b9721b158ea90a9880
Reviewed-on: https://gerrit.libreoffice.org/34238
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:36 +01:00
Ashod Nakashian
22b1ae9553 nb: separate Socket into ClientSocket and ServerSocket
Change-Id: I1aafd6192b955e51b8f1e74c1aad5fc3603f71d6
Reviewed-on: https://gerrit.libreoffice.org/34237
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:36 +01:00
Ashod Nakashian
b6b36f454b nb: refactor the client code into own function
Change-Id: I23735785cc4a66589fd81c7cb0f08476829ba7e8
Reviewed-on: https://gerrit.libreoffice.org/34236
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:36 +01:00
Ashod Nakashian
f41968a726 nb: refactor server code into own function
Change-Id: Iba7363df7452da271fcf9afb54ad1f6177260ddd
Reviewed-on: https://gerrit.libreoffice.org/34235
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:36 +01:00
Ashod Nakashian
10ab785fa4 nb: recreate the poll fds only when needed
Change-Id: I17accfb0339c590b7e155e8fd804e3e32c57e3ed
Reviewed-on: https://gerrit.libreoffice.org/34234
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:36 +01:00
Ashod Nakashian
5ed0c601e3 nb: poll wakeup pipe and simplified polling
Change-Id: I2e688b985d4a9bf7cbe8eef5df10f67bfc96f91c
Reviewed-on: https://gerrit.libreoffice.org/34233
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:36 +01:00
Ashod Nakashian
eed7c4b4f5 nb: gitingore loolnb
Change-Id: I41ed294ce61cb92af065d9fc72e3b35a20be0012
2017-03-10 10:47:36 +01:00
Ashod Nakashian
a8b2f982b6 nb: support N clients and asynchronously communicate with all
Change-Id: I81f63895180141e554072b6cf5300139299f282c
2017-03-10 10:47:36 +01:00
Ashod Nakashian
0edb2f6679 nb: poll using multi-socket poll class SocketPoll
Change-Id: If244c4ec92f70fd458665b88d4da3c5fbcb11077
2017-03-10 10:47:36 +01:00
Ashod Nakashian
f086079d25 nb: SocketPoll class to poll events on N-Sockets
Internally SocketPoll manages the sockets
and handles the polling and firing of callback.

It's thread-safe and handles asynchronous calls
to remove sockets correctly while potentially
being in poll(2).

The choice for using poll(2) compared to epoll
or select are the following:

1. For our use-case, poll(2) works great up to
   a few hundred sockets, which we don't expect
   to have on a single document normally.

2. select(2) has an awkward API (modifies input,
   f.e) and has limit on max fds that we need to
   be mindful of (even if we'll not hit it in
   practice). poll(2) preserves the input and has
   a no-nonsense API that's simple and readable.

3. While select(2) is the most portable, poll(2)
   isn't far behind. Yet in practice we'll probably
   not support other systems than Linux.

4. epoll(2) starts to scale with hundreds or
   thousands of sockets. Meanwhile, it has high
   overhead to adding/removing sockets (context
   switch to kernel and back). Our typical case
   will have a handful to a dozen sockets.
   Hardly a justification for epoll's heavy guns.

Change-Id: Idf88257ea85e061a37af29eed21e38655ff43c9b
2017-03-10 10:47:36 +01:00
Ashod Nakashian
e4563f7d42 nb: ping-pong messages between client and server
Change-Id: I3856dde09764075a138e8574520487e6e5accd90
2017-03-10 10:47:36 +01:00
Ashod Nakashian
85a398ad9c nb: Socket connect supports waiting with timeout
Change-Id: Ib2d713d68f3a27067b121adb356188a164da4589
2017-03-10 10:47:36 +01:00
Ashod Nakashian
976381f633 nb: server now accepts asynchronously
Change-Id: Ic98f31d4f432fc8a06690b94899314b7c9106c69
2017-03-10 10:47:36 +01:00
Ashod Nakashian
d9c88322e2 nb: connect and read asynchronously
Change-Id: I04733f8dbf06f5f31e6b05e7f017ef75c629a015
2017-03-10 10:47:36 +01:00
Ashod Nakashian
3e6ceda91b nb: add polling to Socket
Change-Id: Ie3fd1f271d9c6fa24e8583316e68a443489d1967
2017-03-10 10:47:36 +01:00
Ashod Nakashian
b772f8a860 nb: add socket error getter
Change-Id: Ia0dfd1d6e6bfd2b34b5a9b01c883d78f9bb15e7d
2017-03-10 10:47:36 +01:00
Ashod Nakashian
06990cb703 nb: Socket fd member is const
Change-Id: Icc7f4d9bbd15ce0feb3a58339771fbfd168e20e5
2017-03-10 10:47:36 +01:00
Ashod Nakashian
6a82f12d5f nb: add recv and client connection
Change-Id: I311a475428ff410ca26f6049d5371943aa88cc59
2017-03-10 10:47:36 +01:00
Ashod Nakashian
2ebf4bdd58 nb: accept connections and send
Change-Id: Ie99b8c15e097fcaca0675aba11e11a11c2e7098f
2017-03-10 10:47:36 +01:00
Ashod Nakashian
1e2f7a9f65 nb: bind reuses address automatically
This is virtually always desirable, since
without it we may fail to bind after recycling
if the previous socket is TIME_WAIT.

However, if a socket is bound to same address
this will not prevent the failure to bind,
and we'll detect that the address/port is busy.

So the advantage is in minimizing recycling time.

Change-Id: Ib3bbbf7065f9822acfbd2d7f8ff3e8951739c0ef
2017-03-10 10:47:36 +01:00
Ashod Nakashian
21d6fbd948 nb: Socket doesn't throw on failures and better doc
Change-Id: I125c417c5d9e1a3f40ec386f4871bf6cf2c56ac8
2017-03-10 10:47:35 +01:00
Ashod Nakashian
3d2c2655cd nb: Socket supports listen and accept
Change-Id: I210ee7843f9ff977fde719773b920f1c9c720598
2017-03-10 10:47:35 +01:00
Ashod Nakashian
bd92b09da5 nb: add Socket class
The new socket class is implicitly
non-blocking, streaming, ipv4 socket.

Ipv6 to be added later, as necessary.

Change-Id: I722cc63ea97394d47a50b733c58a69cc1529d815
2017-03-10 10:47:35 +01:00
Ashod Nakashian
41f58f4b4d nb: add new loolnb program
Change-Id: Ib08ff3cdc037876e9c53b87603140b3c603ee916
2017-03-10 10:47:35 +01:00
Pranav Kant
48977108be loleaflet: Allow not inactivating the screen
Change-Id: Iad6233e2855b9260732ce4449668c0fab1cd3804
2017-03-10 14:58:47 +05:30
Pranav Kant
6c333b154a Typo
Change-Id: Iba85f017321806649ab4723a88873894c1b349f3
2017-03-10 14:17:54 +05:30
Henry Castro
bd911ff9d5 loleaflet: rework Impress annotations
LO Impress does not have an anchor position of the annotation object

Change-Id: Ifaa08bb3f62f442f3ee58242e835b6377901a592
2017-03-09 23:01:33 -04:00
Pranav Kant
af3a9110ee loleaflet: Add trackchange flag when object is modified too
Change-Id: I0b1c67737088018e4f87b85b5b10f3c68233c56f
2017-03-09 17:41:41 +05:30
Pranav Kant
148e0f6832 loleaflet: Make caption text bold
Change-Id: I2dbfcf8e341703ba931466e00c269a4a5814c7f9
2017-03-09 17:41:15 +05:30
Pranav Kant
8b3267e32e loleaflet: Add change tracking captions
Use the redline descriptions, such as, "Insert 'text'" etc. as captions
in change tracking sidebar objects.

Change-Id: I6c99f3b45725620b8888da77b0b8b4ebcdda10d2
2017-03-09 17:20:15 +05:30