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 heartbeats signalling between JetBrains IDEs and Gitpod Server #11232

Merged
merged 1 commit into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,37 @@ public GitpodServerConnection listen(
) throws Exception {
String gitpodHost = URI.create(apiUrl).getHost();
HttpClient httpClient;
if (sslContext == null && proxies.size() == 0) {
felladrin marked this conversation as resolved.
Show resolved Hide resolved
GitpodServerConnectionImpl connection = new GitpodServerConnectionImpl(gitpodHost);
connection.setSession(ContainerProvider.getWebSocketContainer().connectToServer(new Endpoint() {
@Override
public void onOpen(Session session, EndpointConfig config) {
session.addMessageHandler(new WebSocketMessageHandler(messageReader, jsonHandler, remoteEndpoint));
messageWriter.setSession(session);
client.notifyConnect();
}

@Override
public void onClose(Session session, CloseReason closeReason) {
connection.complete(closeReason);
}

@Override
public void onError(Session session, Throwable thr) {
GitpodServerConnectionImpl.LOG.log(Level.WARNING, gitpodHost + ": connection error:", thr);
connection.completeExceptionally(thr);
}
}, ClientEndpointConfig.Builder.create().configurator(new ClientEndpointConfig.Configurator() {
@Override
public void beforeRequest(final Map<String, List<String>> headers) {
headers.put("Origin", Arrays.asList(origin));
headers.put("Authorization", Arrays.asList("Bearer " + token));
headers.put("User-Agent", Arrays.asList(userAgent));
headers.put("X-Client-Version", Arrays.asList(clientVersion));
}
}).build(), URI.create(apiUrl)));
return connection;
}
if (sslContext == null) {
httpClient = new HttpClient();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pluginUntilBuild=222.*
# See https://jb.gg/intellij-platform-builds-list for available build versions.
pluginVerifierIdeVersions=2022.2
# Version from "com.jetbrains.intellij.idea" which can be found at https://www.jetbrains.com/intellij-repository/snapshots
platformVersion=222-EAP-SNAPSHOT
platformVersion=222.3345-EAP-CANDIDATE-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ class GitpodTerminalService(private val session: ClientProjectSession) {
thisLogger().error("gitpod: Failed to forward port $hostPort from Supervisor's Terminal " +
"${supervisorTerminal.pid}: $reason")
}

override fun onPortForwardingEnded(hostPort: Int) {
thisLogger().info("gitpod: Port $hostPort from Supervisor's Terminal " +
"${supervisorTerminal.pid} is not being forwarded anymore.")
}
}
}

Expand Down