-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Is there 2.x backward compatibility layer? #285
Comments
It seems a bad idea to me to require other software do support version 3 only or version 2 only, but without possibility to support both versions without significant effort. |
The main problem is that v3 represents a huge rewrite of the whole library with some changes to the API too in order to drastically reduce compilation times. It's not that easy to write a migration layer unfortunately. |
Is any notes documented, how should old code be converted to new library format? |
I have made surprisingly lot of conversions by crude sed script:
It helped in lot of cases. Remaining cases usually were using binduvw::IPv6(std::string, port) style. Is there possible way to use address in std::string and still be able specify family, whether that should use IPv4 or IPv6? Do I have to use sockaddr if I want it specified manually? |
Fair enough. Makes sense.
Yeah, I don't remember all the internals by heart but we mimic the libuv api 90% of the time, so I'd tell you that if you can't do it there then you can't do it in uvw and vice versa. |
I looked into util.cpp, details::ip_addr() in new version. It seems suspicious to me. Does it work correctly for IPV6 addresses? |
DNS software I have seen often uses |
It seems to me backward compatible
It seems to me not in this case. I think the problem is with returning sockaddr by value, not by pointer or reference. Conversion note from libuv 0.10 mentions example how to do that. Since libuv call change just the pointer, it should be safe. But because uvw returns copy of sockaddr, I think that copy would be incomplete for sockaddr_in6. Change of pointer type is safe if it points to data long enough. It seems to me this is not the case in current implementation, where it returns the reference. But since the function returns just sockaddr, I doubt that will work correctly. Returning sockaddr_storage would be safe, just initializing structure by pointer or reference as well. It seems it also hides possible format error in address text, it initializes just zeroed structure. Which might not be the same. Which is not done by original libuv. |
It would be nice if any header had some defines with major (and optionally minor version). That would allow to support somehow also older version from single code, with help of preprocessor's |
The main problem is probably that it's not available in the older versions. |
Sure, you may define it for older versions too: #ifndef UVW_VERSION_MAJOR
#define UVW_VERSION_MAJOR 2
#endif Of course it would be better to have it right from the start, but adding it for next major version would be better than nothing at all. Otherwise just some autoconf hacks might be used to detect proper version. |
Yeah, I mean, I can't really update ie version 2.0.0 and therefore I'd have to create version 2.0.1 for that. However, it doesn't really solve the problem this way. So, it seems pointless to me.
I think one can easily get it with a cmake machinery. You've both the libuv version and the uwv version when generating the project. So, in theory, extracting the version should be possible. Have you tried it already? |
The previous define could be used by the project using uvw, in my case flamethrower. No, I haven't tried cmake compat yet. But to make conditional change to the code, even that cmake would have to define some variable or define, on which conditional preprocessor could choose old or the new format. Wouldn't it be easier if the uvw defined such values itself? CMake might then provide compat definition for previous versions. |
Yeah, it would be easier if |
Closing this due to starvation. |
I were preparing update from 2.12 to 3.0 and tried to compile flamethrower with it. It does not compile anymore because a lot of renamed classes. Is there any backward compatible layer, which would allow supporting old code without changes? Or some way, which might allow modified code to support both 3.0 and 2.12 version?
The text was updated successfully, but these errors were encountered: