For debugging purpose, it's useful to know the client ip from which a request comes.
Checked in v2 after addressing Jun's suggestion
Looks good. Just 1 comment:
10. RichString.format() seems expensive. We probably should use string + in the following statement.
requestLogger.trace("Handling request: %s from remote address: %s".format(request.requestObj, request.remoteAddress))
1. changed the string
2. you need it because there are multiple test cases which create this object.
Thanks for the patch, Sriram! Few very minor comments -
"from remote address" -> "from client"
I don't think we need to have a default for remoteAddress, no ?
I was thinking of just putting the ip in RequestChannel.Request.
You want the ip in RequestOrReponse object for it to be useful when logging the different requests. This would be in RequestChannel.Request.RequestOrReponse. We currently only deserialize from the received buffer to create this object. It would require little more plumbing to have the ip available in these request objects.
This doesn't seem too hard. In Processor.read(), we can add socketChannel.socket.getRemoteSocketAddress() to RequestChannel.Request.