|
|
|
@ -23,7 +23,7 @@ var (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ParseFlagsAndSetup parses necessary core server flags, and sets up the core ready for Start() to be called
|
|
|
|
|
func ParseFlagsAndSetup(errorMessageFunc func(ErrorCode) string) {
|
|
|
|
|
func ParseFlagsAndSetup(proto string, errorMessageFunc func(ErrorCode) string) {
|
|
|
|
|
// Setup numerous temporary flag variables, and store the rest
|
|
|
|
|
// directly in their final operating location. Strings are stored
|
|
|
|
|
// in `string_constants.go` to allow for later localization
|
|
|
|
@ -91,11 +91,14 @@ func ParseFlagsAndSetup(errorMessageFunc func(ErrorCode) string) {
|
|
|
|
|
Port = strconv.Itoa(int(*port))
|
|
|
|
|
FwdPort = strconv.Itoa(int(*fwdPort))
|
|
|
|
|
|
|
|
|
|
// Set protocol string (only really used by CGI and one call to SystemLog)
|
|
|
|
|
protocol = proto
|
|
|
|
|
|
|
|
|
|
// Setup listener
|
|
|
|
|
var err Error
|
|
|
|
|
serverListener, err = newListener(BindAddr, Port)
|
|
|
|
|
if err != nil {
|
|
|
|
|
SystemLog.Fatal(listenerBeginFailStr, BindAddr, Port, err.Error())
|
|
|
|
|
SystemLog.Fatal(listenerBeginFailStr, protocol, Hostname, FwdPort, BindAddr, Port, err.Error())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Host buffer sizes
|
|
|
|
@ -180,7 +183,7 @@ func Start(serve func(*Client)) {
|
|
|
|
|
go FileSystem.StartMonitor()
|
|
|
|
|
|
|
|
|
|
// Start the listener
|
|
|
|
|
SystemLog.Info(listeningOnStr, BindAddr, Port, Hostname, FwdPort)
|
|
|
|
|
SystemLog.Info(listeningOnStr, protocol, Hostname, FwdPort, BindAddr, Port)
|
|
|
|
|
go func() {
|
|
|
|
|
for {
|
|
|
|
|
client, err := serverListener.Accept()
|
|
|
|
|