mSql 4.1 IP socket

amdunn
Posts:2
Joined:Wed Jan 10, 2018 1:11 pm
mSql 4.1 IP socket

Postby amdunn » Wed Jan 10, 2018 1:15 pm

Just downloaded and compiled mSql 4.1 and was tearing my hair out (yes, I have some left) trying to get clients to connect via the TCP socket... which should only require setting the port and setting Remote_Access True in the msql config file.

I turned on "general" debugging and compared output to the source code, and could not see any messaging about the IP Port which should be printed in setupServerSocket() if the code takes the "if" case where Remote_Access is set.

Then I added a MSQLDebug0() call in the "else" case (the case where Remote_Access is false) and still got nothing. Finally changed the debug to a printf() and finally got my message of "NO IP Port" from the "else" case... indicating that Remote_Access was not set (even though I set it True in the config) nor was MSQLDebug working since the MSQLDebug0 didn't print anything but my printf did.

Finally after a bunch of throwing pasta at the wall, I discovered that setupServer() is called AFTER setupServerSockets() and, since the configuration file is read in setupServer(), that meant that the config file hadn't been read yet when doing the server sockets, and thus there was no port. Furthermore, the debug state isn't set yet either since that's also done in setupServer()!

I confirmed this by swapping the order (so setupServer ran first) and... guess what... now my IP socket works and I even get all the debug output.

I'm wondering how it is supposed to work in the package as distributed? What am I missing?

david
Hughes Tech Staff
Posts:25
Joined:Mon Feb 13, 2017 4:55 am

Re: mSql 4.1 IP socket

Postby david » Wed Jan 10, 2018 10:32 pm

Hi amdunn,

Thanks for the feedback. It doesn't sound like you're missing anything - it sounds like we did. If setupServerSocket() is called after setupServer() then, yes, things won't work as expected. There was a lot of movement in that code to modularise it and share it better between the single process and broker based versions of the daemon. Sounds like we didn't get it quite right.

Let me check into it. I'll follow-up to this thread once I've had a look.


Thanks

David
...

david
Hughes Tech Staff
Posts:25
Joined:Mon Feb 13, 2017 4:55 am

Re: mSql 4.1 IP socket

Postby david » Mon Jan 15, 2018 5:07 am

Hi

Your observation about the code was 100% correct. The 2 "setup" routines are being called in the wrong order. We've changed that in our source tree. You can just edit the code to put setupServer() before setupServerSockets() if you want to move forward with this before we release the next version.

Thanks for the feedback and for providing such detailed troubleshooting details!


Thanks

David
...