Commit graph

348 commits

Author SHA1 Message Date
Ashod Nakashian
7a5cc9ce6f nb: correct forkit initialization sequence
This avoids extra kits, avoid logging
unnecessary errors and adds informative logging.

Change-Id: I7a4bb0b690f9787fc362d0b6aefcc722586eaed1
2017-03-10 10:47:44 +01:00
Ashod Nakashian
0bf6e28f54 nb: cleanup old comments and move MAX_CONNECTIONS assertion
Change-Id: I24f3f4321ccc62c26c433d4a709b41c894a0196d
2017-03-10 10:47:44 +01:00
Michael Meeks
42a19e66e3 Centralize idle poll time. 2017-03-10 10:47:44 +01:00
Michael Meeks
438630c68f Start DocBroker thread later - when we've added our 1st session. 2017-03-10 10:47:44 +01:00
Michael Meeks
33d1fa7cc0 Kill SenderThreadPool. 2017-03-10 10:47:44 +01:00
Michael Meeks
e16fc97c15 SocketPoll - better control starting our threads.
Extraordinary trace with a thread starting before the SocketPoll's
derived classes had started - ie. with wrong vtables etc.
2017-03-10 10:47:44 +01:00
Michael Meeks
842b261d9f Move auto-save of document into the DocumentBroker poll more convincingly. 2017-03-10 10:47:44 +01:00
Michael Meeks
c097925e51 Move Kit / prisoner re-balancing into the PrisonerPoll thread. 2017-03-10 10:47:44 +01:00
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
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
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
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
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
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
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
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
Jan Holesovsky
7c9082e2a4 nb: No need to construct a new WebSocketHandler here.
Change-Id: I91bdc71732cd54266a2a3f8c751b09e22b7c83a4
2017-03-10 10:47:42 +01:00
Jan Holesovsky
62afe66df0 nb: Make the loolnb / clientnb work again.
The more testing the better :-)

Change-Id: Ibe4249f18109d50b06e1fa35e6d0fef67f9b3643
2017-03-10 10:47:42 +01:00
Jan Holesovsky
653df9dcce nb: No need for the WebSocketSender I think.
Change-Id: I133bb8341a846d70f95e0c70274541b5db62f65d
2017-03-10 10:47:42 +01:00