Skip to content

Commit bb75a96

Browse files
committed
Don't try spawining more than one daemonized builder
1 parent 785e300 commit bb75a96

File tree

1 file changed

+6
-2
lines changed
  • src/arduino.cc/builder/grpc

1 file changed

+6
-2
lines changed

Diff for: src/arduino.cc/builder/grpc/rpc.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io"
66
"log"
77
"net"
8+
"os"
89
"strings"
910

1011
"arduino.cc/builder"
@@ -193,10 +194,13 @@ func newServer(ctx *types.Context, watcher *fsnotify.Watcher) *builderServer {
193194
}
194195

195196
func RegisterAndServeJsonRPC(ctx *types.Context) {
196-
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+
}
197202
watcher := startWatching(ctx)
198203

199-
lis, _ := net.Listen("tcp", "localhost:12345")
200204
grpcServer := grpc.NewServer()
201205
pb.RegisterBuilderServer(grpcServer, newServer(ctx, watcher))
202206
grpcServer.Serve(lis)

0 commit comments

Comments
 (0)