aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--event.go8
-rw-r--r--netaddr.go6
-rw-r--r--network.go9
m---------salticidae0
-rw-r--r--stream.go2
5 files changed, 17 insertions, 8 deletions
diff --git a/event.go b/event.go
index e4ed463..aa1be2d 100644
--- a/event.go
+++ b/event.go
@@ -27,13 +27,13 @@ func (self ThreadCall) GetEC() EventContext { return C.threadcall_get_ec(self) }
type TimerEvent = *C.timerev_t
type TimerEventCallback = C.timerev_callback_t
-func NewTimerEvent(ec EventContext, cb TimerEventCallback) TimerEvent {
- return C.timerev_new(ec, cb)
+func NewTimerEvent(ec EventContext, cb TimerEventCallback, userdata rawptr_t) TimerEvent {
+ return C.timerev_new(ec, cb, userdata)
}
func (self TimerEvent) Free() { C.timerev_free(self) }
-func (self TimerEvent) SetCallback(callback TimerEventCallback) {
- C.timerev_set_callback(self, callback)
+func (self TimerEvent) SetCallback(callback TimerEventCallback, userdata rawptr_t) {
+ C.timerev_set_callback(self, callback, userdata)
}
func (self TimerEvent) Add(t_sec float64) { C.timerev_add(self, C.double(t_sec)) }
diff --git a/netaddr.go b/netaddr.go
index 0a8af8b..3836a9c 100644
--- a/netaddr.go
+++ b/netaddr.go
@@ -16,3 +16,9 @@ func NewAddrFromIPPortString(addr string) (res NetAddr) {
func (self NetAddr) Free() { C.netaddr_free(self) }
func (self NetAddr) IsEq(other NetAddr) bool { return bool(C.netaddr_is_eq(self, other)) }
+
+func (self NetAddr) IsNull() bool { return bool(C.netaddr_is_null(self)) }
+
+func (self NetAddr) GetIP() uint32 { return uint32(C.netaddr_get_ip(self)) }
+
+func (self NetAddr) GetPort() uint16 { return uint16(C.netaddr_get_port(self)) }
diff --git a/network.go b/network.go
index 9b5b07d..a4cac02 100644
--- a/network.go
+++ b/network.go
@@ -44,16 +44,17 @@ func (self MsgNetwork) Start() { C.msgnetwork_start(self) }
func (self MsgNetwork) SendMsg(msg Msg, conn MsgNetworkConn) { C.msgnetwork_send_msg(self, msg, conn) }
func (self MsgNetwork) Connect(addr NetAddr) { C.msgnetwork_connect(self, addr) }
+func (self MsgNetwork) Terminate(conn MsgNetworkConn) { C.msgnetwork_terminate(self, conn) }
type MsgNetworkMsgCallback = C.msgnetwork_msg_callback_t
type MsgNetworkConnCallback = C.msgnetwork_conn_callback_t
-func (self MsgNetwork) RegHandler(opcode Opcode, callback MsgNetworkMsgCallback) {
- C.msgnetwork_reg_handler(self, C._opcode_t(opcode), callback)
+func (self MsgNetwork) RegHandler(opcode Opcode, callback MsgNetworkMsgCallback, userdata rawptr_t) {
+ C.msgnetwork_reg_handler(self, C._opcode_t(opcode), callback, userdata)
}
-func (self MsgNetwork) RegConnHandler(callback MsgNetworkConnCallback) {
- C.msgnetwork_reg_conn_handler(self, callback)
+func (self MsgNetwork) RegConnHandler(callback MsgNetworkConnCallback, userdata rawptr_t) {
+ C.msgnetwork_reg_conn_handler(self, callback, userdata)
}
type PeerNetwork = *C.struct_peernetwork_t
diff --git a/salticidae b/salticidae
-Subproject 66c711cf653b082ae07e1119417dcb3461039c8
+Subproject 299d1a3cf7f7ab2465dccc87dde578044c9b040
diff --git a/stream.go b/stream.go
index 1e7860f..3037281 100644
--- a/stream.go
+++ b/stream.go
@@ -82,7 +82,9 @@ func (self UInt256) UInt256IsNull() bool { return bool(C.uint256_is_null(self))
func (self UInt256) UInt256IsEq(other UInt256) bool { return bool(C.uint256_is_eq(self, other)) }
func (self UInt256) Serialize(s DataStream) { C.uint256_serialize(self, s) }
func (self UInt256) Unserialize(s DataStream) { C.uint256_unserialize(self, s) }
+func (self UInt256) IsEq(other UInt256) bool { return bool(C.uint256_is_eq(self, other)) }
func (self DataStream) GetHash() UInt256 {
return C.datastream_get_hash(self)
}
+