Jan Holesovsky
b895393cea
nb: Perform the socket shutdown asynchronously after the data is served.
...
Change-Id: I642e26abf4ef9c8d2be1be428b5786692dfea2c7
2017-03-10 10:47:44 +01:00
Ashod Nakashian
b8af470918
nb: serve files synchronously
...
As there isn't support (yet) to send files
asynchronously, when the socket native buffer
is small, asynchronous writes naturally return
EWOULDBLOCK. As a temp solution, we send files
synchronously, so there is no need to poll.
This should be replaced witha file-server
polling/serving thread that is dedicated to
sending files only (which closes the connection
when done).
Change-Id: I062fea44bfe54ab8d147b745da97bd499bf00657
2017-03-10 10:47:44 +01:00
Michael Meeks
37de43bb58
Tie sockets to threads, and assert that we're being used in the right one.
...
This shows up some problems around cleaning up prisoners etc. that will
need fixing subsequently.
2017-03-10 10:47:43 +01:00
Michael Meeks
0eaef6c896
config.h - get includes right: must always be the first include.
2017-03-10 10:47:43 +01:00
Jan Holesovsky
c4c8d93bba
nb: Blind attempt to fix running inside docker.
...
If nothing, it will at least improve the logging.
Change-Id: I35a8eb620a210aea9cf55c0eb47bda7b0d777cf8
2017-03-10 10:47:43 +01:00
Jan Holesovsky
59c5eeec4c
Fix build.
...
Change-Id: I218895b6ba314250f0009fa465499f38953b49d8
2017-03-10 10:47:43 +01:00
Michael Meeks
d807db08f2
More descriptive comment.
2017-03-10 10:47:43 +01:00
Ashod Nakashian
ec3e795813
nb: remove superfluous assertion
...
Change-Id: I22e0e031768e52f83b6e0f062df61aaf6e881279
2017-03-10 10:47:43 +01:00
Ashod Nakashian
826217b4d8
nb: move the child socket to DocBroker poll
...
Change-Id: I8cbec60e49ca508df0e96e7e594f9dad15f84276
2017-03-10 10:47:43 +01:00
Ashod Nakashian
9f90722673
nb: contain exceptions when adding new session and loading
...
Change-Id: I35e6714e87eaf2c65d36bbf813ac1fd286a0fbb7
2017-03-10 10:47:43 +01:00
Ashod Nakashian
7b1ed1b4d4
nb: more informative logging of socket activity
...
Change-Id: I9036c778c195936678c6451ba57cc794d6ba0006
2017-03-10 10:47:43 +01:00
Ashod Nakashian
221bfdefc8
nb: get the poll sockets size after setting up
...
Change-Id: I35174f2f9345286791ccefe2d6dc521a767b6571
2017-03-10 10:47:43 +01:00
Ashod Nakashian
d6aa3324d5
nb: childProcess might not exist yet when terminating
...
Change-Id: I28b84233ea47ca0d8e3be33ba73d1165f37adb40
2017-03-10 10:47:43 +01:00
Ashod Nakashian
0f1c5827ec
nb: sockets may disconnect before loading
...
So startDestroy must not assume the session
was already added at that point, since addSession
is done when we poll for reading, but not when
the socket has already disconnected.
Change-Id: I7bb7222604269c1cc9f2f4b4dad3ea1054b3e0c9
2017-03-10 10:47:43 +01:00
Ashod Nakashian
aee954af8b
nb: include the SocketPoll name in logs
...
Change-Id: I7a93edfe0bc74e62bd2726f6fa8425c719326023
2017-03-10 10:47:43 +01:00
Ashod Nakashian
222b5562c3
nb: DocumentBroker::pollThread now non-static member
...
Change-Id: Ib95611f6f696f5810ce7fcb3a4bb67c1d7ac13ac
2017-03-10 10:47:43 +01:00
Michael Meeks
ce4bd9b9be
Unify DocumentBroker thread and its SocketPoll.
2017-03-10 10:47:43 +01:00
Michael Meeks
79fb1e2c1f
Sub-class the SocketPoll to allow more flexibility in termination.
2017-03-10 10:47:43 +01:00
Jan Holesovsky
bffa8e5532
nb: We have to provide the jailed document path to the queued load message.
...
The document / path does not exist until after we actually load the document.
Change-Id: I9162d7975a53bb25a2c6da3fa3b3afacc7539e99
2017-03-10 10:47:43 +01:00
Ashod Nakashian
a8ddbf55f2
nb: fixme to merge DocumentBroker polling thread with SocketPoll
...
Change-Id: I82c289b0d30f687bc9ce7bb6ba5d85a248449f63
2017-03-10 10:47:43 +01:00
Ashod Nakashian
6a29fc943b
nb: remove unused polling threads
...
Change-Id: I1255a41447f735c3f5d70ac88077da7adf0eef90
2017-03-10 10:47:43 +01:00
Ashod Nakashian
c6dbce9767
nb: transfer client sockets to respective DocumentBroker
...
Change-Id: I6af656ec6cbb09d4dd80b7b583a009a763de6eb9
2017-03-10 10:47:43 +01:00
Ashod Nakashian
5a8734b7de
nb: cleanup defunct socket code
...
Change-Id: Iaff9d530ca4a62eb3dcf3068f86d0bd52c47a5d0
2017-03-10 10:47:43 +01:00
Ashod Nakashian
76e96c92c8
nb: SocketPoll is now a thread object
...
Change-Id: I01d13292f0b97a9ebd1ccdef9e41fec46bfa0b11
2017-03-10 10:47:43 +01:00
Jan Holesovsky
8b8bb67cd7
Fix a misplaced ENABLE_SSL #endif.
...
Change-Id: Ie2a4b777f7df422eca18e3a1b5331b9e0c722c52
2017-03-10 10:47:43 +01:00
Michael Meeks
52327d78e2
Cleanout old socket code, and several obsolete LOOLWebSocket uses.
2017-03-10 10:47:43 +01:00
Michael Meeks
c84f9738fd
Disable new-style unit tests for now.
2017-03-10 10:47:43 +01:00
Michael Meeks
20f15d4001
Switch Prisoner socket handling to use the SocketPoll.
...
Kills the Poco ThreadPool usage, and significantly improves debuggability.
2017-03-10 10:47:43 +01:00
Michael Meeks
a856a95138
Dump buffer contents as hex if we have them.
2017-03-10 10:47:42 +01:00
Jan Holesovsky
6083911a0d
nb: Remember also the messages sent to sessions queued for creation.
...
Without this, it was impossible to connect to an existing session, because we
were trying to send messages to sessions that were not connected yet.
Change-Id: If9260a1f0ac8f5387f492541548724b0065df9d9
2017-03-10 10:47:42 +01:00
Jan Holesovsky
380624ba32
nb: Remove also the queued sessions.
...
Change-Id: I455fbbabfea9805d70fe909fd9b4078f02d21438
2017-03-10 10:47:42 +01:00
Ashod Nakashian
3b67f709d2
nb: Fix race when loading a document.
...
Don't block when creating new sessions, instead queue the requests, and handle
them in the DocumentBroker.
Change-Id: I200bbfc740f004c37178fa316d1eb91afdde5d4a
2017-03-10 10:47:42 +01:00
Jan Holesovsky
1914f9215c
Revert "Horror hack to avoid race for now."
...
This reverts commit e977667754ba34b83ba0259d6568aa88ae5995df.
2017-03-10 10:47:42 +01:00
Michael Meeks
d4cc2e899c
ClientSession: kill the writing thread.
2017-03-10 10:47:42 +01:00
Michael Meeks
6711701721
Socket API to allow asynchronous writing.
2017-03-10 10:47:42 +01:00
Michael Meeks
1655e5d062
Improve socket state dumping on USR1.
2017-03-10 10:47:42 +01:00
Jan Holesovsky
4be3ac614d
nb: Fix polling with http.
...
When we call readIncomingData() outside of the poll, we read the data, and
store them into the buffer. But then the next poll will not indicate that
there data actually some available (they've been already read from the FD),
and we will get stuck.
I susppect we should remove from the SSL case at some stage too, to be
symmetrict to the non-SSL case.
Change-Id: Ib8339400b41e797adb2eb8519f87093ebf6be9c5
2017-03-10 10:47:42 +01:00
Michael Meeks
1b8e6f8c78
Horror hack to avoid race for now.
2017-03-10 10:47:42 +01:00
Michael Meeks
11c2e15a93
Rename members: accept and webserver pieces have cleaner names.
...
As distinct from the websocket poll per DocumentBroker.
2017-03-10 10:47:42 +01:00
Michael Meeks
4f883e9fc4
Setup a poll per DocumentBroker with thread to go with that.
...
Also dung out a chunk of older code.
FIXME: websocket / ClientSession needs to associate itself with the
DocumentBroker poll loop in place of the original loop.
2017-03-10 10:47:42 +01:00
Michael Meeks
073a216aa1
Annotate some blocking methods - ugly, but necessary.
2017-03-10 10:47:42 +01:00
Michael Meeks
333f8994e9
Cleanup shutdown flag handling.
...
Pull the notification pieces out of SigUtil.cpp - not signal safe,
and invoked only from LOOLWSD anyway.
In a non-blocking world, the socket close notification sends are
instant - so more work required to count-down / timeout remaining
clients.
2017-03-10 10:47:42 +01:00
Ashod Nakashian
d68377748d
nb: ReadOrWrite -> Neither
...
SSL only requests what to poll for next.
So it's more accurate to rename ReadOrWrite
to Neither, since in that case SSL really
isn't blocked on either read or write.
Change-Id: I62dd4f94730d51666a7661b10a9d582d69fbf45e
2017-03-10 10:47:42 +01:00
Ashod Nakashian
9c0d8cc5b2
nb: log more socket activity
...
Change-Id: Ibcdf5abc3054691c93382c00bb8a9ecc4b882652
2017-03-10 10:47:42 +01:00
Ashod Nakashian
2ed8c3d875
nb: search for free client port
...
Change-Id: I33238e83756481267c222b3cd3b9d30f4fcd3d48
2017-03-10 10:47:42 +01:00
Michael Meeks
892e755700
Cleanup shutdown.
2017-03-10 10:47:42 +01:00
Michael Meeks
fa96673ee0
Connect USR1 to initial global state dumping goodness.
2017-03-10 10:47:42 +01:00
Michael Meeks
fffd970425
Work around global initialization order issue with global wakeups.
2017-03-10 10:47:42 +01:00
Michael Meeks
fa6b756346
signal handling: keep track of all socket poll wakeups & wakeup.
...
Instead of waiting for polls to timeout; wake them up.
2017-03-10 10:47:42 +01:00
Jan Holesovsky
7c9082e2a4
nb: No need to construct a new WebSocketHandler here.
...
Change-Id: I91bdc71732cd54266a2a3f8c751b09e22b7c83a4
2017-03-10 10:47:42 +01:00