lost server part 5 - failed init goes to lost state
commitc402548a31f61184b77e0fc915ca6a156101b10d
authorLucian Wischik <ljw@fb.com>
Fri, 8 Sep 2017 20:24:55 +0000 (8 13:24 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 8 Sep 2017 20:32:14 +0000 (8 13:32 -0700)
tree3439c4d2928e5b99509abff9a71dbb19b17dcab4
parent67d9dc6d26bc67d23997c90f0951f3b956de8b6b
lost server part 5 - failed init goes to lost state

Summary:
Previously we had two separate ways to indicate a failed connection:

(1) if failure happened within 3 seconds of an LSP initialization request then we returned a failure response in the conventional LSP manner so the LSP client could invite the user to retry initialization;

(2) if failure happened later than that during initialization, or if it happened at any time even after initialization had failed, then we entered a "lost_server" state and indicated to the user that they needed to restart.

I think that doesn't make sense for our connection to a persistent singleton server. It's much cleaner if we say that LSP initialization always succeeds (and we opt entirely out of the LSP "failure/retry during initialization" cycle). Instead, we ourselves will manage our connection to the server, and we'll use just a single means to indicate failure to the user. So these are the states:

* Pre_init: the client hasn't yet sent initialize
* In_init: the client send initialize, and we responded, and we're about to try establish a connection to hh_server
* Main_loop: we did establish a connection\!
* Lost_server: either we failed to establish a connection, or we did establish a connection but it was subsequently lost.

Reviewed By: alexchow

Differential Revision: D5620642

fbshipit-source-id: f1cccc67224ecc949f2e1c44e19255450ff21706
hphp/hack/src/client/clientLsp.ml