-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
39 lines (34 loc) · 1.02 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/
package main
import (
"fmt"
"net"
"github.com/getgauge/flash/event"
gm "github.com/getgauge/flash/gauge_messages"
"github.com/getgauge/flash/listener"
"google.golang.org/grpc"
)
func startAPI(e chan event.Event) {
address, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0")
if err != nil {
panic("failed to start server.")
}
l, err := net.ListenTCP("tcp", address)
if err != nil {
panic("failed to start server.")
}
server := grpc.NewServer(grpc.MaxRecvMsgSize(1024 * 1024 * 1024))
h := listener.NewHandler(server, e)
gm.RegisterReporterServer(server, h)
fmt.Printf("Listening on port:%d\n", l.Addr().(*net.TCPAddr).Port)
server.Serve(l)
}
func main() {
e := make(chan event.Event)
go startAPI(e)
listener.NewHttpListener(e).Start()
}