aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-06-21 14:27:17 -0400
committerDeterminant <[email protected]>2019-06-21 14:27:17 -0400
commit720096e3dcc84cc0ab821841fdae249a4a029758 (patch)
treea5965600f260fc60f71e525b9bfdae64f572d88d
parent1dfc133c0167fbba818b46883950bf87554f5dc1 (diff)
...
-rw-r--r--network.go27
m---------salticidae0
-rw-r--r--stream.go10
3 files changed, 23 insertions, 14 deletions
diff --git a/network.go b/network.go
index c30e3d3..04d653b 100644
--- a/network.go
+++ b/network.go
@@ -94,7 +94,14 @@ func (self MsgNetwork) Listen(addr NetAddr, err *Error) { C.msgnetwork_listen(se
func (self MsgNetwork) Start() { C.msgnetwork_start(self.inner) }
func (self MsgNetwork) Stop() { C.msgnetwork_stop(self.inner) }
-func (self MsgNetwork) SendMsgByMove(msg Msg, conn MsgNetworkConn) { C.msgnetwork_send_msg_by_move(self.inner, msg.inner, conn.inner) }
+func (self MsgNetwork) SendMsg(msg Msg, conn MsgNetworkConn) {
+ C.msgnetwork_send_msg(self.inner, msg.inner, conn.inner)
+}
+
+func (self MsgNetwork) SendMsgDeferredByMove(msg Msg, conn MsgNetworkConn) {
+ C.msgnetwork_send_msg_deferred_by_move(self.inner, msg.inner, conn.inner)
+}
+
func (self MsgNetwork) Connect(addr NetAddr, err *Error) MsgNetworkConn {
res := MsgNetworkConnFromC(C.msgnetwork_connect(self.inner, addr.inner, err))
runtime.SetFinalizer(res, func(self MsgNetworkConn) { self.free() })
@@ -227,17 +234,21 @@ func (self PeerNetworkConn) Copy() PeerNetworkConn {
func (self PeerNetworkConn) free() { C.peernetwork_conn_free(self.inner) }
-func (self PeerNetwork) SendMsgByMove(_moved_msg Msg, paddr NetAddr) {
- C.peernetwork_send_msg_by_move(self.inner, _moved_msg.inner, paddr.inner)
+func (self PeerNetwork) Listen(listenAddr NetAddr, err *Error) {
+ C.peernetwork_listen(self.inner, listenAddr.inner, err)
+}
+
+func (self PeerNetwork) SendMsg(msg Msg, addr NetAddr) {
+ C.peernetwork_send_msg(self.inner, msg.inner, addr.inner)
}
-func (self PeerNetwork) MulticastMsgByMove(_moved_msg Msg, paddrs []NetAddr) {
- na := NewAddrArrayFromAddrs(paddrs)
- C.peernetwork_multicast_msg_by_move(self.inner, _moved_msg.inner, na.inner)
+func (self PeerNetwork) SendMsgDeferredByMove(msg Msg, addr NetAddr) {
+ C.peernetwork_send_msg_deferred_by_move(self.inner, msg.inner, addr.inner)
}
-func (self PeerNetwork) Listen(listenAddr NetAddr, err *Error) {
- C.peernetwork_listen(self.inner, listenAddr.inner, err)
+func (self PeerNetwork) MulticastMsgByMove(msg Msg, paddrs []NetAddr) {
+ na := NewAddrArrayFromAddrs(paddrs)
+ C.peernetwork_multicast_msg_by_move(self.inner, msg.inner, na.inner)
}
type MsgNetworkUnknownPeerCallback = C.msgnetwork_unknown_peer_callback_t
diff --git a/salticidae b/salticidae
-Subproject c69b0150fe0c50b91c7c8a406f096de8e9cf62f
+Subproject 823585c4db2ef6752d12f489c83edab577b8609
diff --git a/stream.go b/stream.go
index 7d42020..39bfd5c 100644
--- a/stream.go
+++ b/stream.go
@@ -50,12 +50,10 @@ func NewDataStreamFromBytes(bytes []byte) (res DataStream) {
func (self DataStream) free() { C.datastream_free(self.inner) }
-func (self DataStream) AssignByCopy(src DataStream) {
- C.datastream_assign_by_copy(self.inner, src.inner)
-}
-
-func (self DataStream) AssignByMove(src DataStream) {
- C.datastream_assign_by_move(self.inner, src.inner)
+func (self DataStream) Copy() {
+ res := &dataStream{ inner: C.datastream_copy(self.inner, src.inner) }
+ runtime.SetFinalizer(res, func(self DataStream) { self.free() })
+ return res
}
// TODO: datastream_data