mirror of
https://github.com/spiffcode/hostile-takeover.git
synced 2025-12-16 12:08:36 +00:00
36 lines
771 B
C++
36 lines
771 B
C++
#include "base/socketserver.h"
|
|
#include "base/socket.h"
|
|
|
|
namespace base {
|
|
|
|
// Convenient helpers (not necessary, but nice to have)
|
|
|
|
Socket *SocketServer::CreateSocket(int type, SocketNotify *notify) {
|
|
Socket *socket = new Socket(this);
|
|
if (socket->Create(type, notify)) {
|
|
return socket;
|
|
}
|
|
delete socket;
|
|
return NULL;
|
|
}
|
|
|
|
Socket *SocketServer::WrapSocket(int s, SocketNotify *notify) {
|
|
Socket *socket = new Socket(this);
|
|
if (socket->Attach(s, notify)) {
|
|
return socket;
|
|
}
|
|
delete socket;
|
|
return NULL;
|
|
}
|
|
|
|
// Can't put this in the include file because of class definition ordering issues
|
|
|
|
void Dispatcher::OnEvent(dword ff) {
|
|
if (dispatchee_ != NULL) {
|
|
dispatchee_->OnEvent(ff);
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace base
|