-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix stop
of socket server
#33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @eneufeld! Change looks good to me and the server shutdown now seem to properly dispose all resources 👍🏼 I have a few minor remarks/nitpicks as inline comments.
import { createAppModule } from '../di/app-module'; | ||
import { defaultSocketLaunchOptions } from './socket-cli-parser'; | ||
import { SocketServerLauncher } from './socket-server-launcher'; | ||
describe('test createCliParser', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe('test createCliParser', () => { | |
describe('test SocketServerLauncher', () => { |
const appContainer = new Container(); | ||
appContainer.load(createAppModule(defaultSocketLaunchOptions)); | ||
const launcher = appContainer.resolve(SocketServerLauncher); | ||
launcher.start({ port: 5007 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use a different port here. Just to avoid failing tests if the workflow example server is currently running as well.
@@ -29,13 +29,14 @@ export class SocketServerLauncher extends GLSPServerLauncher<net.TcpSocketConnec | |||
|
|||
protected currentConnections: jsonrpc.MessageConnection[] = []; | |||
protected startupCompleteMessage = START_UP_COMPLETE_MSG; | |||
private netServer: net.Server; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private netServer: net.Server; | |
protected netServer: net.Server; |
The socket server currently does not actually shutdown the server when calling shutdown. In order to do so, the `close` method must be called on the server. Thus the server was moved into a private member to be able to call `close` on `stop`. This also fixes the test launch configs and adds a test. Furthermore the overriden methods in SocketServerLauncher are not public anymore in order to have a clean api. Contributed on behalf of STMicroelectronics.
bccb77b
to
cf39942
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks
The socket server currently does not actually shutdown the server when calling shutdown.
In order to do so, the
close
method must be called on the server. Thus the server was moved into a private memberto be able to call
close
onstop
.This also fixes the test launch config and adds a test. Furthermore the overriden methods in SocketServerLauncher are not public anymore in order to have a clean api.
Contributed on behalf of STMicroelectronics.