Skip to content

Commit

Permalink
Update dns_lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Jul 2, 2014
1 parent 1add5c6 commit e1d3f5f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/async/dns_lookup.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
swoole_async_dns_lookup("www.baidu阿斯顿.com", function($host, $ip){
swoole_async_dns_lookup("www.baidu.com", function($host, $ip){
echo "{$host} reslove to {$ip}\n";
swoole_event_exit();
});
4 changes: 2 additions & 2 deletions src/os/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int swoole_aio_onFinish(swReactor *reactor, swEvent *event)
{
int i;
swAio_event *events[SW_AIO_EVENT_NUM];
int n = read(event->fd, events, sizeof(swAio_event*)*SW_AIO_EVENT_NUM);
int n = read(event->fd, events, sizeof(swAio_event*) * SW_AIO_EVENT_NUM);
if (n < 0)
{
swWarn("read failed. Error: %s[%d]", strerror(errno), errno);
Expand Down Expand Up @@ -165,7 +165,7 @@ static int swoole_aio_thread_onTask(swThreadPool *pool, void *task, int task_len
{
memcpy(&addr, host_entry->h_addr_list[0], host_entry->h_length);
ip_addr = inet_ntoa(addr);
memcpy(event->buf, ip_addr, strnlen(ip_addr, SW_IP_MAX_LENGTH));
memcpy(event->buf, ip_addr, strnlen(ip_addr, SW_IP_MAX_LENGTH) + 1);
ret = 0;
}
break;
Expand Down
3 changes: 2 additions & 1 deletion swoole_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

#define PHP_SWOOLE_AIO_MAXEVENTS 128

typedef struct {
typedef struct
{
zval *callback;
zval *filename;
int fd;
Expand Down

0 comments on commit e1d3f5f

Please sign in to comment.