osmo: Add hostname/port to the error messages
This commit is contained in:
parent
108ff0b0b1
commit
92add56e05
|
@ -48,6 +48,15 @@ supervising the RX/TX process and re-starting.'>
|
|||
^port
|
||||
]
|
||||
|
||||
targetDescription [
|
||||
<category: 'accessing'>
|
||||
^(WriteStream on: String new)
|
||||
nextPutAll: hostname;
|
||||
nextPut: $:;
|
||||
nextPutAll: port asString;
|
||||
contents
|
||||
]
|
||||
|
||||
connect [
|
||||
<category: 'connect'>
|
||||
socket ifNotNil: [socket close].
|
||||
|
@ -59,16 +68,18 @@ supervising the RX/TX process and re-starting.'>
|
|||
started := true.
|
||||
|
||||
[
|
||||
self logNotice: 'Attempting to connect' area: #osmo.
|
||||
self logNotice: ('Attempting to connect to ',
|
||||
self targetDescription) area: #osmo.
|
||||
self connect
|
||||
] on: self class connectionException do: [
|
||||
self logError: 'Failed to connect.' area: #osmo.
|
||||
self logError: ('Failed to connect to ',
|
||||
self targetDescription) area: #osmo.
|
||||
^Osmo.TimerScheduler instance scheduleInSeconds: 1 block: [self reconnect]].
|
||||
|
||||
rx_proc :=
|
||||
[Processor activeProcess name: 'OsmoAppConnection-RX'.
|
||||
[Processor activeProcess name: 'OsmoAppConnection-RX ', self targetDescription.
|
||||
[self driveDispatch] repeat] fork.
|
||||
tx_proc := [Processor activeProcess name: 'OsmoAppConnection-TX'.
|
||||
tx_proc := [Processor activeProcess name: 'OsmoAppConnection-TX ', self targetDescription.
|
||||
[self driveSend] repeat] fork
|
||||
]
|
||||
|
||||
|
@ -93,13 +104,16 @@ supervising the RX/TX process and re-starting.'>
|
|||
[
|
||||
self dispatchOne
|
||||
] on: SystemExceptions.EndOfStream do: [:e |
|
||||
self logError: 'OsmoApplication eof' area: #osmo.
|
||||
self logError: ('OsmoApplication dispatch eof on ',
|
||||
self targetDescription) area: #osmo.
|
||||
self scheduleReconnect
|
||||
] on: SystemExceptions.FileError do: [:e |
|
||||
self logError: 'OsmoApplication file-error' area: #osmo.
|
||||
self logError: ('OsmoApplication dispatch file-error on ',
|
||||
self targetDescription) area: #osmo.
|
||||
self scheduleReconnect
|
||||
] on: Error do: [:e |
|
||||
e logException: 'OsmoApplication error' area: #osmo.
|
||||
e logException: ('OsmoApplication dispatch error on ',
|
||||
self targetDescription) area: #osmo.
|
||||
self scheduleReconnect
|
||||
]
|
||||
]
|
||||
|
@ -109,17 +123,19 @@ supervising the RX/TX process and re-starting.'>
|
|||
[
|
||||
self sendOne
|
||||
] on: SystemExceptions.EndOfStream do: [:e |
|
||||
self logError: 'OsmoApplication eof' area: #osmo.
|
||||
self logError: ('OsmoApplication send eof on ',
|
||||
self targetDescription) area: #osmo.
|
||||
self scheduleReconnect
|
||||
] on: Error do: [:e |
|
||||
e logException: 'OsmoApplication error' area: #osmo.
|
||||
e logException: ('OsmoApplication send error on ',
|
||||
self targetDescription) area: #osmo.
|
||||
self scheduleReconnect
|
||||
]
|
||||
]
|
||||
|
||||
reconnect [
|
||||
<category: 'private'>
|
||||
self logNotice: 'Going to reconnect socket' area: #osmo.
|
||||
self logNotice: ('Going to reconnect socket to ', self targetDescription) area: #osmo.
|
||||
self terminate.
|
||||
started ifTrue: [self start]
|
||||
]
|
||||
|
|
Reference in New Issue