Bug fixes and improvements
+ Add a function to the Tools package to provide the local IP address and port + Add a function to the Tools package to provide a time as formated string as yyyyMMdd hhmmss.fff + Improved the ICCC startup message: Now, the message contains the IP address and port of the stared server + Add a new configuration to specific the necessary Ocean servers' port (internally, not the public port) + The template package reports now which version out of the grid FS is used. + The Ocean server is now bound to the correct IP address and port (rule: the local IP address!) + The order of the system shutdown handlers were wrong! + The early ICCC messages problem is now fixed! + Fixed an ICCC bug for the case, that a message does not have any payload! + Also the configuration database uses now the correct mgo MongoDB rules (SetSafe & SetMode)
This commit is contained in:
1 parent
7120a729bd
commit
a007db1b79
16 files changed
+145
-26
No files matched your search
@@ -0,0 +1,58 @@
|
||||
package Tools
|
||||
|
||||
import "time"
|
||||
import "fmt"
|
||||
import "strconv"
|
||||
|
||||
func FormatTime(t1 time.Time) (result string) {
|
||||
var year int = t1.Year()
|
||||
var month int = int(t1.Month())
|
||||
var day int = int(t1.Day())
|
||||
var minutes int = int(t1.Minute())
|
||||
var hours int = int(t1.Hour())
|
||||
var seconds int = int(t1.Second())
|
||||
var milliseconds int = int(float64(t1.Nanosecond()) / 1000000.0)
|
||||
|
||||
var monthText, dayText, minutesText, hoursText, secondsText, millisecondsText string
|
||||
|
||||
if month >= 1 && month <= 9 {
|
||||
monthText = fmt.Sprintf(`0%d`, month)
|
||||
} else {
|
||||
monthText = strconv.Itoa(month)
|
||||
}
|
||||
|
||||
if day >= 1 && day <= 9 {
|
||||
dayText = fmt.Sprintf(`0%d`, day)
|
||||
} else {
|
||||
dayText = strconv.Itoa(day)
|
||||
}
|
||||
|
||||
if minutes >= 0 && minutes <= 9 {
|
||||
minutesText = fmt.Sprintf(`0%d`, minutes)
|
||||
} else {
|
||||
minutesText = strconv.Itoa(minutes)
|
||||
}
|
||||
|
||||
if hours >= 0 && hours <= 9 {
|
||||
hoursText = fmt.Sprintf(`0%d`, hours)
|
||||
} else {
|
||||
hoursText = strconv.Itoa(hours)
|
||||
}
|
||||
|
||||
if seconds >= 0 && seconds <= 9 {
|
||||
secondsText = fmt.Sprintf(`0%d`, seconds)
|
||||
} else {
|
||||
secondsText = strconv.Itoa(seconds)
|
||||
}
|
||||
|
||||
if milliseconds >= 0 && milliseconds <= 9 {
|
||||
millisecondsText = fmt.Sprintf(`00%d`, milliseconds)
|
||||
} else if milliseconds >= 10 && milliseconds <= 99 {
|
||||
millisecondsText = fmt.Sprintf(`0%d`, milliseconds)
|
||||
} else {
|
||||
millisecondsText = strconv.Itoa(milliseconds)
|
||||
}
|
||||
|
||||
result = fmt.Sprintf(`%d%s%s %s%s%s.%s`, year, monthText, dayText, hoursText, minutesText, secondsText, millisecondsText)
|
||||
return
|
||||
}
|
||||
@@ -24,4 +24,9 @@ func init() {
|
||||
|
||||
// Set the seed for random:
|
||||
rand.Seed(time.Now().Unix())
|
||||
|
||||
// Build the local IP address and port:
|
||||
allHostsIPAddresses := ReadAllIPAddresses4ThisHost()
|
||||
port := ConfigurationDB.Read(`OceanServerPort`)
|
||||
localIPAddressAndPort = allHostsIPAddresses[0] + `:` + port
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package Tools
|
||||
|
||||
func LocalIPAddressAndPort() (address string) {
|
||||
address = localIPAddressAndPort
|
||||
return
|
||||
}
|
||||
+5
-4
@@ -3,8 +3,9 @@ package Tools
|
||||
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
|
||||
var (
|
||||
senderName LM.Sender = `System::Tools`
|
||||
hostname string = `unknown`
|
||||
ipAddresses []string = nil
|
||||
internalCommPassword string = ``
|
||||
senderName LM.Sender = `System::Tools`
|
||||
hostname string = `unknown`
|
||||
localIPAddressAndPort string = `127.0.0.1:60000`
|
||||
ipAddresses []string = nil
|
||||
internalCommPassword string = ``
|
||||
)
|
||||
Reference in new issue
Block a user