We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 785e300 commit bb75a96Copy full SHA for bb75a96
src/arduino.cc/builder/grpc/rpc.go
@@ -5,6 +5,7 @@ import (
5
"io"
6
"log"
7
"net"
8
+ "os"
9
"strings"
10
11
"arduino.cc/builder"
@@ -193,10 +194,13 @@ func newServer(ctx *types.Context, watcher *fsnotify.Watcher) *builderServer {
193
194
}
195
196
func RegisterAndServeJsonRPC(ctx *types.Context) {
-
197
+ lis, err := net.Listen("tcp", "localhost:12345")
198
+ if err != nil {
199
+ //can't spawn two grpc servers on the same port
200
+ os.Exit(0)
201
+ }
202
watcher := startWatching(ctx)
203
- lis, _ := net.Listen("tcp", "localhost:12345")
204
grpcServer := grpc.NewServer()
205
pb.RegisterBuilderServer(grpcServer, newServer(ctx, watcher))
206
grpcServer.Serve(lis)
0 commit comments