-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid sending double CRLF keep alive on TCP socket shutdown #172
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -602,7 +602,7 @@ public void run() { | |
int nbytes = myClientInputStream.read(msg, 0, bufferSize); | ||
// no more bytes to read... | ||
if (nbytes == -1) { | ||
hispipe.write("\r\n\r\n".getBytes("UTF-8")); | ||
hispipe.write("\r\n".getBytes("UTF-8")); // send \r\n to allow the pipe to wake up | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about wrapping this in a new method, e.g. then we don't need comments!! ; ) \ o / There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im not sure we can savely assume this branch is becuase of socket closed, certainly the inputstream has reached end. I can see the original author probably choosed doubleCRLF becuase is an small message,yet still valid under the heartbeat Spec. sending a single CRLF may cuase issues for some remote peers, who knows? If the original concern of the PR is that " sometimes this will lead to the error message", why dont we try to review the log level of that message?. Jain-SIP stack is known to be quite verbose,and not using log level conventions properly. We have tried to alleviate this several times by reducing the log level, but there might be still some messages to tweak. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gsaslis: Yes, I think the only reason for sending a double CRLF was to wakeup the pipe. Therefore the new method would cover it. 2018-02-05 19:22:37,842 WARN nist.javax.sip.stack.IOHandler [] IOException occured retryCount 0 |
||
try { | ||
if (sipStack.maxConnections != -1) { | ||
synchronized (messageProcessor) { | ||
|
@@ -720,9 +720,9 @@ public InetAddress getPeerPacketSourceAddress() { | |
|
||
/* | ||
* (non-Javadoc) | ||
* @see gov.nist.javax.sip.parser.SIPMessageListener#sendSingleCLRF() | ||
* @see gov.nist.javax.sip.parser.SIPMessageListener#sendSingleCRLF() | ||
*/ | ||
public void sendSingleCLRF() throws Exception { | ||
public void sendSingleCRLF() throws Exception { | ||
lastKeepAliveReceivedTime = System.currentTimeMillis(); | ||
|
||
if(mySock != null && !mySock.isClosed()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even though this seems like a clear typo, i'm concerned this would break backwords compatibility... 🤔
Maybe a default implementation here for the new one invoking the old one would help us get the best of both worlds...
@jaimecasero thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this interface is not part of JAIN-SIP spec, and is not a boundary with the App. Is an internal API to allow IO layer to contact Parsing layer. If we change this interface, we will need to cover all the neccesary changes tin IO and parsing layer (XPipelineParsers,ConnOrientedMsgChannel,TCPMsgChannel,TLSMsgChannel...).
not sure is worth the change, but we could do it if the PR is comprehensive and tests results are ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggests to handle in different PRs, as the original concern about double CRLF on TCP closing seems valid. We could potentially merge this asap, and then think about the typo...