-
Notifications
You must be signed in to change notification settings - Fork 503
WIP: #776 - socket_recvfrom / socket_sendto support #780
WIP: #776 - socket_recvfrom / socket_sendto support #780
Conversation
src/socket.c
Outdated
recv_buf = zend_string_alloc(len + 1, 0); | ||
|
||
switch (threaded->store.sock->type) { | ||
case AF_UNIX: |
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 will need a check for win32
src/socket.c
Outdated
int retval; | ||
|
||
switch (threaded->store.sock->type) { | ||
case AF_UNIX: |
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.
same here
a18b96e
to
88eec0c
Compare
check for win32 added, @dktapps |
I haven't had chance to test this yet, will take a look over the weekend. |
Some issues I picked up on:
|
@sirsnyder I've created a few commits you might be interested in cherry-picking (commits 1a1f562, 60401fe and d644417). I've tested this and it seems to be working fine with my additional patches, but one problem I did spot:
works, and I don't have to define
raises TypeErrors ( |
Also, I haven't tested IPv6 or Unix socket yet. |
@sirsnyder please also take a look at pmmp/ext-pmmpthread@27ee665 and pmmp/ext-pmmpthread@2300bcc |
src/socket.c
Outdated
sin6.sin6_family = AF_INET6; | ||
|
||
if (port == NULL) { | ||
efree(recv_buf); |
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.
shouldn't this be zend_string_free()
? (it is also the same in PHP sockets though)
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.
Yes, you're right. This should be ```zend_string_free()``, changed.
…t_recvfrom_sendto
it took me about half an hour to find this...
this matches the behaviour of PHP sockets, not requiring that the variables be pre-initialized to the correct type.
Thanks for your commits @dktapps! Would you report the efree/zend_string_free issue to php/php-src? Otherwise I would do that. |
@sirsnyder reported, thanks. |
--SKIPIF-- | ||
<?php | ||
if (substr(PHP_OS, 0, 3) == 'WIN') { | ||
die('skip Not valid for Windows'); |
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 is valid if compiled with --enable-ipv6
. The AppVeyor configure options might need some adjustments.
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.
Can you adjust AppVeyor to support IPV6?
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.
Sure, I'll create a PR. Also, some of these tests aren't working correctly (see https://travis-ci.org/krakjoe/pthreads/jobs/334677874#L800)
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.
Looks like a travis issue travis-ci/travis-ci#8711
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.
For the time being fixed with eaa0a58
Support of socket_recvfrom() and socket_sendto(), equal to php socket API