Skip to content
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

Merged
merged 1 commit into from
Dec 21, 2022

Conversation

eneufeld
Copy link
Contributor

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 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.

Copy link
Contributor

@tortmayr tortmayr left a 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', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
describe('test createCliParser', () => {
describe('test SocketServerLauncher', () => {

const appContainer = new Container();
appContainer.load(createAppModule(defaultSocketLaunchOptions));
const launcher = appContainer.resolve(SocketServerLauncher);
launcher.start({ port: 5007 });
Copy link
Contributor

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.

.vscode/launch.json Show resolved Hide resolved
@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks

@tortmayr tortmayr merged commit beafa1a into eclipse-glsp:main Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants