Skip to content

Commit

Permalink
Supported EM#get_sockname for AcceptorDescriptor, per request by Roge…
Browse files Browse the repository at this point in the history
…r Pack.

git-svn-id: http://rubyeventmachine.com/svn/trunk@687 2c60eb90-88cd-488e-9351-1edcb1d70dbc
  • Loading branch information
francis committed May 15, 2008
1 parent 28e51a8 commit f2d1233
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ daemons saslauthd and pwcheck.
30Apr08: Set the NODELAY option on sockets that we connect to other servers.
Omission noted by Roger Pack.
14May08: Generated a 0.12 release.
15May08: Supported EM#get_sockname for acceptors (TCP server sockets).
Requested by Roger Pack.
16 changes: 16 additions & 0 deletions ext/ed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,22 @@ void AcceptorDescriptor::Heartbeat()
}


/*******************************
AcceptorDescriptor::GetSockname
*******************************/

bool AcceptorDescriptor::GetSockname (struct sockaddr *s)
{
bool ok = false;
if (s) {
socklen_t len = sizeof(*s);
int gp = getsockname (GetSocket(), s, &len);
if (gp == 0)
ok = true;
}
return ok;
}



/**************************************
Expand Down
2 changes: 2 additions & 0 deletions ext/ed.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ class AcceptorDescriptor: public EventableDescriptor
virtual bool SelectForRead() {return true;}
virtual bool SelectForWrite() {return false;}

virtual bool GetSockname (struct sockaddr*);

static void StopAcceptor (const char *binding);
};

Expand Down

0 comments on commit f2d1233

Please sign in to comment.