Basic listen works
This commit is contained in:
parent
e96d371896
commit
2738fa7e58
5 changed files with 57 additions and 7 deletions
7
Makefile
7
Makefile
|
@ -1,6 +1,6 @@
|
|||
CXXFLAGS := $(CXXFLAGS) --std=c++11 -fPIC -DDART_SHARED_LIB=1 -I $(DART_SDK)/include
|
||||
objects := lib/src/angel_wings.o lib/src/wings_socket.o\
|
||||
lib/src/bind.o
|
||||
lib/src/bind.o lib/src/util.o
|
||||
|
||||
.PHONY: distclean clean
|
||||
|
||||
|
@ -13,10 +13,13 @@ clean:
|
|||
find . -type f -name '*.so' -delete
|
||||
find . -type f -name '*.dylib' -delete
|
||||
|
||||
mac: lib/src/libangel_wings.dylib
|
||||
mac: libangel_wings.dylib
|
||||
|
||||
linux: lib/src/libangel_wings.so
|
||||
|
||||
libangel_wings.dylib: lib/src/libangel_wings.dylib
|
||||
cp $< $@
|
||||
|
||||
lib/src/libangel_wings.dylib: $(objects)
|
||||
|
||||
%.dylib: $(objects)
|
||||
|
|
|
@ -138,7 +138,7 @@ WingsSocket *wingsBindNewSocket(Dart_NativeArguments arguments, const WingsSocke
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto *out = new WingsSocket(info);
|
||||
auto *out = new WingsSocket(sock, info);
|
||||
globalSocketList.push_back(out);
|
||||
return out;
|
||||
}
|
||||
|
|
21
lib/src/util.cc
Normal file
21
lib/src/util.cc
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "angel_wings.h"
|
||||
|
||||
void Dart_WingsSocket_getPort(Dart_NativeArguments arguments)
|
||||
{
|
||||
// TODO: Actually do something.
|
||||
}
|
||||
|
||||
void Dart_WingsSocket_write(Dart_NativeArguments arguments)
|
||||
{
|
||||
// TODO: Actually do something.
|
||||
}
|
||||
|
||||
void Dart_WingsSocket_closeDescriptor(Dart_NativeArguments arguments)
|
||||
{
|
||||
// TODO: Actually do something.
|
||||
}
|
||||
|
||||
void Dart_WingsSocket_close(Dart_NativeArguments arguments)
|
||||
{
|
||||
// TODO: Actually do something.
|
||||
}
|
|
@ -1 +1,27 @@
|
|||
#include <cstring>
|
||||
#include "wings_socket.h"
|
||||
using namespace wings;
|
||||
|
||||
std::vector<WingsSocket *> wings::globalSocketList;
|
||||
|
||||
bool WingsSocketInfo::operator==(const WingsSocketInfo &other) const
|
||||
{
|
||||
return (strcmp(address, other.address) == 0) &&
|
||||
port == other.port;
|
||||
}
|
||||
|
||||
WingsSocket::WingsSocket(int sockfd, const WingsSocketInfo &info) : sockfd(sockfd), info(info)
|
||||
{
|
||||
refCount = 0;
|
||||
}
|
||||
|
||||
void WingsSocket::incrRef(Dart_Port port)
|
||||
{
|
||||
refCount++;
|
||||
sendPorts.push_back(port);
|
||||
}
|
||||
|
||||
const WingsSocketInfo &WingsSocket::getInfo() const
|
||||
{
|
||||
return info;
|
||||
}
|
|
@ -19,9 +19,9 @@ struct WingsSocketInfo
|
|||
class WingsSocket
|
||||
{
|
||||
public:
|
||||
explicit WingsSocket(const WingsSocketInfo& info);
|
||||
explicit WingsSocket(int sockfd, const WingsSocketInfo& info);
|
||||
void incrRef(Dart_Port port);
|
||||
const WingsSocketInfo getInfo() const;
|
||||
const WingsSocketInfo& getInfo() const;
|
||||
|
||||
private:
|
||||
WingsSocketInfo info;
|
||||
|
|
Loading…
Reference in a new issue